0

I'm attempting to upload a file using Mediafire's API. Its not clear to me what they expect in the body of the message. I'm attempting to follow the API described in https://www.mediafire.com/developers/upload.php#upload

My understanding is that some parameters are passed in a query string as part of the URL. I'm passing the session_token on the URL.

I set an HTTP header for the file size, x-filesize.

I'm setting the method to POST and sending to base url (before the query string) http://www.mediafire.com/api/upload/upload.php

Its not clear to me what should be in the body. I tried including the pure data from the file being uploaded. I've also tried adding more data to make it look like multipart form.

In either case I'm getting no response at all from the server. I'm doing this in objective-c on a Mac. The NSURLConnection request comes back with nil response and nil error. I'm using

NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
David
  • 2,770
  • 5
  • 35
  • 43

1 Answers1

0

The Mediafire upload API is expecting parameters to be send in the URL as the query string, GET style.

The data from the file is included in the body as a multipart form. If the body is improperly constructed, Mediafire may not return a relevant error.

Headers specified in the API are sent as headers in the body.

The 'path' parameter only appears to be honored if a uploadkey is also provided. No error is provided indicating if the path parameter was honored.

Maximum file size appears to be around 4MB.

David
  • 2,770
  • 5
  • 35
  • 43