Network error when using the official uploader UI
The official uploader UI (React included version) gives "A network error" on each upload try.
What happens (as seen in the dev tools) is: it starts the upload, makes a call to
https://upload.box.com/api/2.0/files/content
with file size, gets 404 (file not found BECAUSE IT WASN'T UPLOADED YET) and decides it's a network error.
I changed a line in the uploader source code from
this.uploadPreflight()
to
this.uploadPreflightSuccessHandler(e))
in the upload function.
And now it meets a network error after the upload is finished. (The file is not uploaded anyway)
Uploader is at version 1.0.2
-
Hello oreolek, do you have some sample code for your use case? You can also try plugging in your developer token and folder ID into the sample CodePen here: https://codepen.io/box-platform/pen/QvqGwr
The first call to https://upload.box.com/api/2.0/files/content is correct since that's how the Box Upload File API works (https://developer.box.com/reference#upload-a-file). The preflight call checks whether the file you want to upload will be accepted by Box before you have to send the bytes over the wire.
-
Two possibilities that I can think of:
- Have you added the domains of both your app and the two needed by CodePen (https://s.codepen.io and http://s.codepen.io) to the CORS whitelisted domains in your application configuration? See: https://developer.box.com/docs/box-content-uploader#section-cross-origin-resource-sharing
- Make sure the folder ID is a string and not an integer (e.g. use '0'). The fact that we don't support integers isn't great so we'll update this to support both numbers and strings in a later release.
サインインしてコメントを残してください。
コメント
5件のコメント