cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Upload failing on iOS9.3 (Expecting a file upload)

New member | Level 2
New member | Level 2

Just started getting customer reports that uploads from my app are failing.

Tried it myself and it works ok on iOS9.2 but not on iOS9.3 ?

The error I'm getting from Dropbox is 400 and JSON containing the following:

"Expecting a file upload"

I receive this AFTER apparently uploading the whole file (I see all the callback indications after each lump of data has been sent.)

Not sure if this is related to iOS9.3 or something at the Dropbox end (my app has not changed in years....)

Anyone else seeing the same.

Thanks.

PS: Using the core api v2 and NSURLConnection

 

10 Replies 10
Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

Dropboxer
Dropboxer

Can you share some sample code to reproduce the issue? Thanks in advance! 

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

New member | Level 1
New member | Level 1

Experiencing the same error since this morning (8 AM UTC+01:00 to be exact), nothing changed on our part. We also receive an "Expecting a file upload" on every upload. We are using the API on a Linux PHP system so it probably has nothing to do with iOS.

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

Dropboxer
Dropboxer

Thanks for the additional report Freddie. Can you share the relevant code? That would help us reproduce the track down the issue.

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

New member | Level 1
New member | Level 1

Here is the object, hope this helps.

Dropbox_OAuth_PHP Object
(
[oAuth:protected] =>
[authorizeCallbackUrl] =>
[oauth_token:protected] => *****
[oauth_token_secret:protected] => *****
[lastResponse:protected] => Array
(
)

[inFile:protected] =>
[inFileSize:protected] =>
[putSupported:protected] =>
[OAuth] => OAuth Object
(
[debug] => 1
[sslChecks] => 0
[debugInfo] => Array
(
[sbs] => POST&https%3A%2F%2Fapi-content.dropbox.com%2F1%2Ffiles%2Fsandbox%2Fleku%2F%2F&file%3Dtest.txt%26oauth_consumer_key%3D********%26oauth_nonce%3D********%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1459072553%26oauth_token%3D*****%26oauth_version%3D1.0
[headers_sent] => Content-Type: multipart/form-data; boundary=R50hrfBj5JYyfR3vF3wR96GPCC9Fd2q2pVMERvEaOE3D8LZTgLLbRpNwXek3
[headers_recv] => HTTP/1.1 400 Bad Request
Server: nginx
Date: Sun, 27 Mar 2016 09:55:54 GMT
Content-Type: application/json
Connection: close
X-Dropbox-Request-Id: 059d14f9ba8fbae16e903f2eaa271fe6
X-Robots-Tag: noindex, nofollow, noimageindex
[body_sent] => --R50hrfBj5JYyfR3vF3wR96GPCC9Fd2q2pVMERvEaOE3D8LZTgLLbRpNwXek3
Content-Disposition: form-data; name=file; filename=test.txt
Content-type: application/octet-stream

roelandtest
--R50hrfBj5JYyfR3vF3wR96GPCC9Fd2q2pVMERvEaOE3D8LZTgLLbRpNwXek3--
[body_recv] => {"error": {"file": "Expecting a file upload"}}
)

)

)

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

New member | Level 2
New member | Level 2

I found the issue - and it looks the same as reported by Freddie also. 

For some installs I am using OAuth1 and the POST /1/files/dropbox/ method to upload. This doesn't seem to work anymore.

For other installs I am using the (recommended) OAuth2 and PUT /1/files_put/dropbox method to upload. This works ok.

The reason I do things differently for different installs is that I use the (unsupported?) dbapi-2:// URL method to launch the Dropbox app (if installed) in order to get it to authorise the user. It then returns me the OAuth1 fields. I guess I could use OAuth1 and the files_put method, but I could get that to work and it always worked the old way.

So my conclusion is that Dropbox have stopped supporting OAuth1 and the POST /1/files/dropbox method recently? Or perhaps they stopped supporting it a while ago and it's only now that it's actually stopped working? Nothing to do with iOS9.3 or even iOS.

 

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

New member | Level 1
New member | Level 1

We've resolved the issue by using cURL instead of PHP to communicate and this works as well. We are still using OAuth1 though. It appears Dropbox changed something that causes this to happen since both Craig and I didn't change anything and it suddenly stopped working. It's weird though that there are not that many complaints/solutions for this problem on the internet (so far).

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

Dropboxer
Dropboxer

Thanks for the additional information, it's very helpful.

The /1/files (POST) endpoint is an old upload method on the Core API, a.k.a. API v1. That endpoint is technically supported, and it looks like its behavior did change, which we're looking in to. However, we do strongly recommend using /1/files_put instead, as it's generally easier to implement and debug. Most apps use this endpoint instead.

Further, API v1, including both of these upload endpoints, supports both OAuth 1 and OAuth 2, with OAuth 2 being preferred.

The dbapi-2:// URL scheme on iOS isn't directly related to this. That's an undocumented URL scheme used by the official iOS Core SDK to handle the OAuth app authorization on iOS. We generally don't recommend using that manually, as it's not documented. If you do use it though, it will return a normal OAuth 1 access token to your app. You can also get OAuth 2 tokens from OAuth 1 tokens using /oauth2/token_from_oauth1.

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

New member | Level 2
New member | Level 2

I've updated my app to use the files_put method just gotta wait for Apple approval now :-(

Thanks for the info regarding converting OAuth1 to 2 tokens - didn't know that!

Highlighted

Re: Upload failing on iOS9.3 (Expecting a file upload)

Dropboxer
Dropboxer

The /files (POST) endpoint should be working again now. Please let me know if you're still seeing any issues.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?