REST Api Upload Error No Files were received

  • 1
  • Problem
  • Updated 7 months ago
I am using the REST api from an iOS app using the AFNetworking library to upload a file.  The file seems to upload to the ChunkUri in that I see my progress callback happening.  But when the transfer is finished I get a 200 code with the following text:

ERROR: upload.aspx: ID='7584276b-b91b-4425-91de-46db79d4281c' No files were received!

And when I checked the folder via the web browser, no files were uploaded.

Any tips on why this could be happening?
Photo of Steven Smith

Steven Smith

  • 4 Posts
  • 2 Reply Likes

Posted 2 years ago

  • 1
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 714 Posts
  • 99 Reply Likes
Hi Steven,

It means our storage servers could not understand the file contents sent.When you get the initial upload specification (where the ChunkUri is returned) do you set the Raw parameter to true? It may be you're sending the files as multipart when they should be sent as plain file bytes, if raw is true.

Eli
Photo of Steven Smith

Steven Smith

  • 4 Posts
  • 2 Reply Likes
Hi Eli,
No, we are not setting the raw flag as we are using multipart.  Do you know of any code examples using Objective-C to upload?  If so I could compare what they are doing to how I have things set up.

In any case, here is a code fragment of what I am doing:

                                NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:chunkUri parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
                                    [formData appendPartWithFileURL:[NSURL fileURLWithPath:zipFilePath] name:meaNumber fileName:[NSString stringWithFormat:@"%@.zip",meaNumber] mimeType:@"application/zip" error:nil];
                                } error:nil];
                                NSDictionary *headers = [request allHTTPHeaderFields];

                                AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
                                manager.responseSerializer = [AFHTTPResponseSerializer serializer];
                                [manager POST:chunkUri parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
                                    [formData appendPartWithFileURL:[NSURL fileURLWithPath:zipFilePath] name:meaNumber fileName:[NSString stringWithFormat:@"%@.zip",meaNumber] mimeType:@"application/zip" error:nil];
                                   
                                   
                                    // etc.
                                }  progress:^(NSProgress * _Nonnull uploadProgress) {
                                    // This is not called back on the main queue.
                                    // You are responsible for dispatching to the main queue for UI updates
                                    dispatch_async(dispatch_get_main_queue(), ^{
                                        //Update the progress view
                                        //[progressView setProgress:uploadProgress.fractionCompleted];
                                        NSLog(@"%f",uploadProgress.fractionCompleted);
                                    });
                                }
                                success:^(NSURLSessionDataTask *task, id responseObject) {
                                    NSLog(@"Response: %@", responseObject);
                                    NSError *error1;
                                    NSString *innerJson = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
                                    NSLog(@"%@",innerJson);
                                } failure:^(NSURLSessionDataTask *task, NSError *error) {
                                    NSLog(@"Error: %@", error);
                                }];

                                

/steve
(Edited)
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 713 Posts
  • 99 Reply Likes
Steve,

Unfortunately I do not see any Objective-C samples on our site and no one on the API team is very familiar with it. However, if you could provide the raw trace of an http call that fails, we can take a look and figure out what's wrong. We'd need to see the request url, headers, and body content, as well as the response.

Thanks!
Eli
Photo of Steven Smith

Steven Smith

  • 4 Posts
  • 2 Reply Likes
Hi Eli,

Attached are 2 traces. 

Upload.trace is my iOS app doing the upload which does not work. 
==============
HTTP-Trace-Version: 1.0
Generator: Charles/4.0.1

Method: POST
Protocol-Version: HTTP/1.1
Protocol: https
Host: storage-ec2-249.sharefile.com
File: /upload.aspx?uploadid=17a79309-283b-497a-9374-d770f35df04a&tool=apiv3&batchid=55c3686e-ed5a-4297-946a-3d205377651b&encparams=xlow_f9KqcOg6WVKapYH1eIX7Gx61OaBrq4njqodu8xaUmo-SlmkPfggty4aEGlENKoBTCKPFZTKuUPOFKWxglxJQD4haGh6_UGf-2_vP2Fk3_e14_nVW17L2w5WKWyNI0uB0ShgmN03PeLHzYBpwVSjHoFpyvIxLVAadnEaCZfvlJMPpYz5f1U89GSEIqwHmh9dG-Ph9KZMhawdkcT0TNN8RuudIQzN6zhj7t4Ycc-0CcIfvJmY4BGxksa_rbRMQ0o1rQi8Naq-R61GyVsAGpj41eY2DlQq7XNxB7dmbsE-E0CdJxbE7M9IA25yXrCiKG-SBQfBj9OVcpqJQMQ-xNr7Yz_sOhCxhbx4_03Vj6-vCUhCgKG0N2irt8TjuOxSFWgMMOTqgvaReeBsuWF413_fnapmwKg-j3V7ytwR21MyHgYOVulQ7u4hWjPs4w_3BHrJA58623DILZwEHyPRIGoOgKFQuuog9DQIT-d2rGi948JPGNLKYaz_LL_A9jXIoXX4ZBrqrx-bCpCbqzrC3PdAiSN6FOqIuVhd87jz7gP76RQnMqcJHy44xnd-3Ra_vD2-LRMQXYVJdygwP8dvQcNlUg$$&h=EKQgsiS35AmUzENTvSc7pkgmquVnjM9y5%2bPwQ5Z8yqY%3d
Remote-Address: 52.45.37.139
Client-Address: 127.0.0.1
Start-Time: 2016-10-07T09:11:57.831-04:00
DNS-Duration: 85
Connect-Duration: 42
Request-Begin-Time: 2016-10-07T09:11:57.832-04:00
Request-Time: 2016-10-07T09:11:57.834-04:00
Response-Time: 2016-10-07T09:11:57.886-04:00
End-Time: 2016-10-07T09:11:57.886-04:00
Request-Header-Size: 1081
Response-Header-Size: 369
Request-Body-Size: 203
Response-Body-Size: 85
Request-Body-Decoded: false
Response-Body-Decoded: false
Request-Header:<<--EOF-1475846581478-
POST /upload.aspx?uploadid=17a79309-283b-497a-9374-d770f35df04a&tool=apiv3&batchid=55c3686e-ed5a-4297-946a-3d205377651b&encparams=xlow_f9KqcOg6WVKapYH1eIX7Gx61OaBrq4njqodu8xaUmo-SlmkPfggty4aEGlENKoBTCKPFZTKuUPOFKWxglxJQD4haGh6_UGf-2_vP2Fk3_e14_nVW17L2w5WKWyNI0uB0ShgmN03PeLHzYBpwVSjHoFpyvIxLVAadnEaCZfvlJMPpYz5f1U89GSEIqwHmh9dG-Ph9KZMhawdkcT0TNN8RuudIQzN6zhj7t4Ycc-0CcIfvJmY4BGxksa_rbRMQ0o1rQi8Naq-R61GyVsAGpj41eY2DlQq7XNxB7dmbsE-E0CdJxbE7M9IA25yXrCiKG-SBQfBj9OVcpqJQMQ-xNr7Yz_sOhCxhbx4_03Vj6-vCUhCgKG0N2irt8TjuOxSFWgMMOTqgvaReeBsuWF413_fnapmwKg-j3V7ytwR21MyHgYOVulQ7u4hWjPs4w_3BHrJA58623DILZwEHyPRIGoOgKFQuuog9DQIT-d2rGi948JPGNLKYaz_LL_A9jXIoXX4ZBrqrx-bCpCbqzrC3PdAiSN6FOqIuVhd87jz7gP76RQnMqcJHy44xnd-3Ra_vD2-LRMQXYVJdygwP8dvQcNlUg$$&h=EKQgsiS35AmUzENTvSc7pkgmquVnjM9y5%2bPwQ5Z8yqY%3d HTTP/1.1
Host: storage-ec2-249.sharefile.com
Content-Type: multipart/form-data; boundary=Boundary+625CAC2BD9965A6E
Connection: keep-alive
Accept: */*
User-Agent: SL Enrollment/1.0 (iPad; iOS 10.0; Scale/2.00)
Accept-Language: en;q=1
Content-Length: 203
Accept-Encoding: gzip, deflate


--EOF-1475846581478-
Response-Header:<<--EOF-1475846581478-
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 85
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 3628800
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Methods: OPTIONS, TRACE, GET, HEAD, POST
Date: Fri, 07 Oct 2016 13:11:28 GMT
Connection: Keep-alive


--EOF-1475846581478-
Request-Body:<<--EOF-1475846581478-
{
  "name": "sdsmith",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

--EOF-1475846581478-
Response-Body:<<--EOF-1475846581478-
ERROR: upload.aspx: ID='17a79309-283b-497a-9374-d770f35df04a' No files were received!
--EOF-1475846581478-

==============



Upload2.trace is using curl which does work.
==============
HTTP-Trace-Version: 1.0
Generator: Charles/4.0.1

Method: POST
Protocol-Version: HTTP/1.1
Protocol: https
Host: storage-ec2-215.sharefile.com
File: /upload.aspx?uploadid=eb7f1b3d-ccdd-414f-a1c4-9e6761ec920f&tool=apiv3&batchid=fb1ef5ff-d8fe-4f81-a7cb-13fd110652e6&encparams=JPAJ7y3xiZGCyEvt3gR8xywsRbdiincEMzAYJQcNCGetxWH8SEWhau-K_b5e6Anb_KCotTJhvh60rS9S3dMs1TRfcop0EqjNtiBly1pHEXScmqXhBkdZ94kcH7Ou0Rn8On7z7fvzZ0ZN9dMkKhCZBgw5rk7SAV0qHSHE3Cd3Xix4aZ2P-mhnnhGHbeJQQkubk6ftUm_mJR7wIiAJUn56xe8I0n-dIs2W9310RMSecw-v6KhutK4nTTx7XLv-nWVXyXu3CfP2HqEftjnJR30GT-RReQZXaQOcU1OzfFMl0UrZZPgK0BgYTo_fFwj3gZwJlFSdZC5Xu2EO_goWDZxXH6CTR_8wiQQneJTfedwwxkA9lKuIWBPNhLBJdBuevDnx2RiTCYZIlmNm20Hjj0Uf3hBKllGGPy8AvXpmlIpiJwa_pL0Hl3d55fK8Pj_rT8EKKlWlAkxyra4zVBa8D8SL88viXwNeGukxY_4ZGRZNTLMAtYc6fr0uJR1-X1OTCDRTc_kNciRHWlcIUUv7E_FBrhqW3H2iHpeN0Kb2SH2y_W0rk9ibML0iGUksL0pM4K2g8to13aUWnrh3XtxzvlcDVT4oJg$$&h=9Ug5H%2bGNcCjGVCkooPg25R%2blAlLUkeYRVDDuizFeeQw%3d
Remote-Address: 52.71.182.174
Client-Address: 127.0.0.1
Start-Time: 2016-10-07T09:27:25.247-04:00
DNS-Duration: 85
Connect-Duration: 40
Request-Begin-Time: 2016-10-07T09:27:25.248-04:00
Request-Time: 2016-10-07T09:27:26.250-04:00
Response-Time: 2016-10-07T09:27:38.970-04:00
End-Time: 2016-10-07T09:27:38.970-04:00
Request-Header-Size: 1004
Response-Header-Size: 367
Request-Body-Size: 408
Response-Body-Size: 2
Request-Body-Decoded: false
Response-Body-Decoded: false
Request-Header:<<--EOF-1475846956150-
POST /upload.aspx?uploadid=eb7f1b3d-ccdd-414f-a1c4-9e6761ec920f&tool=apiv3&batchid=fb1ef5ff-d8fe-4f81-a7cb-13fd110652e6&encparams=JPAJ7y3xiZGCyEvt3gR8xywsRbdiincEMzAYJQcNCGetxWH8SEWhau-K_b5e6Anb_KCotTJhvh60rS9S3dMs1TRfcop0EqjNtiBly1pHEXScmqXhBkdZ94kcH7Ou0Rn8On7z7fvzZ0ZN9dMkKhCZBgw5rk7SAV0qHSHE3Cd3Xix4aZ2P-mhnnhGHbeJQQkubk6ftUm_mJR7wIiAJUn56xe8I0n-dIs2W9310RMSecw-v6KhutK4nTTx7XLv-nWVXyXu3CfP2HqEftjnJR30GT-RReQZXaQOcU1OzfFMl0UrZZPgK0BgYTo_fFwj3gZwJlFSdZC5Xu2EO_goWDZxXH6CTR_8wiQQneJTfedwwxkA9lKuIWBPNhLBJdBuevDnx2RiTCYZIlmNm20Hjj0Uf3hBKllGGPy8AvXpmlIpiJwa_pL0Hl3d55fK8Pj_rT8EKKlWlAkxyra4zVBa8D8SL88viXwNeGukxY_4ZGRZNTLMAtYc6fr0uJR1-X1OTCDRTc_kNciRHWlcIUUv7E_FBrhqW3H2iHpeN0Kb2SH2y_W0rk9ibML0iGUksL0pM4K2g8to13aUWnrh3XtxzvlcDVT4oJg$$&h=9Ug5H%2bGNcCjGVCkooPg25R%2blAlLUkeYRVDDuizFeeQw%3d HTTP/1.1
Host: storage-ec2-215.sharefile.com
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 408
Expect: 100-continue
Content-Type: multipart/form-data; boundary=------------------------f8ee516b0ac1ca4d


--EOF-1475846956150-
Response-Header:<<--EOF-1475846956150-
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 2
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 3628800
Access-Control-Allow-Headers: content-type
Access-Control-Allow-Methods: OPTIONS, TRACE, GET, HEAD, POST
Date: Fri, 07 Oct 2016 13:27:09 GMT
Connection: Keep-alive


--EOF-1475846956150-
Request-Body:<<--EOF-1475846956150-
--------------------------f8ee516b0ac1ca4d
Content-Disposition: form-data; name="File1"; filename="package.json"
Content-Type: application/octet-stream

{
  "name": "sdsmith",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

--------------------------f8ee516b0ac1ca4d--

--EOF-1475846956150-
Response-Body:<<--EOF-1475846956150-
OK
--EOF-1475846956150-


==============
Photo of Eliezer Encarnacion

Eliezer Encarnacion, Official Rep

  • 713 Posts
  • 99 Reply Likes
Steven,

Thanks for providing detailed examples! We'll go over these to figure out why the Objective C uploads are not working correctly.

FYI, we're hopefully releasing an Objective-C SDK very soon so a lot of this will be abstracted.

Eli
(Edited)
Photo of Steven Smith

Steven Smith

  • 4 Posts
  • 2 Reply Likes
Hi Eli,

I found the problem.  The issue was I was not setting the name parameter of the multi-part form data to "File1".  It was not clear from the documentation that this is a requirement for a file transfer.  I thought I could name it anything.  Once I set File1 for the name parameter the uploads worked for standard and the streaming methods.

We can consider this issue closed.

Thanks!
/steve
Photo of Oskar Tynelius

Oskar Tynelius

  • 1 Post
  • 0 Reply Likes
I seemed to have had the same issue, TYVM for posting the solution. 

Also: the necessity of name="File1" is not something I can find anywhere in the docs, except here. 
Photo of Paul Tremblay

Paul Tremblay

  • 2 Posts
  • 0 Reply Likes
Yes, I found the same problem and the above suggestion worked. Actually, it seems you can use name = "Filex" where x is an integer (at least in a few tests I ran). Documentation would really help here.
Photo of Paul Tremblay

Paul Tremblay

  • 2 Posts
  • 0 Reply Likes