Hello. I am trying to upload jpg images according to the spec at:
https://backendless.com/documentation/files/rest/files_file_upload.htm
For example, doing a POST to:
https://api.backendless.com/v1/files/savedFiles2/123.jpg
with headers:
Content-type:multipart/form-data
application-id:20B6BCEC-3854-082A-FFEB-62B6E777F500
secret-key: XXXXXXXXXX
application-type:REST
and form-data with the file gets Status 200:{“fileURL”:“https://api.backendless.com/20b6bcec-3854-082a-ffeb-62b6e777f500/v1/files/savedFiles2/123.jpg”}
But I can’t access the image, it doesn’t really exist!
Hi, Shai!
Just checked the sample request from the documentation link you provided. The file is uploaded and is available by link:
{“fileURL”:“https://api.backendless.com/247721d1-4fdc-934e-ff98-54bf9f457400/v1/files/image.png”}
Hi Anatolii,
Thanks for taking the time to answer.
I know that the basic curl example works (it also works for me), but using various clients like Postman, or cordova-plugin-file-transfer, apparently changes the request a bit (adding, not modifying). For example, using Postman Changes the Content-Type header slightly so that it is:
-H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
While it is somewhat plausible not to support these kind of headers, I think it is not acceptable to return a status 200 to the request with a file url, when in fact the transaction fails and the returned url is broken. Wouldn’t you agree?
I think it is a bug because a transaction should be atomic - it either succeeds or fails.
If I get status 200 with a fileUrl I understand that it succeeded and the file exists…
If the system chose to fail the transaction (because of headers or something), then an error status code is in order (and hopefully an explanation why it fails)…
Hi, Shai!
We’ve opened the internal ticket for this issue BKNDLSS-12866 and will look into it.
Thanks for reporting!