Note that there are some explanatory texts on larger screens.

plurals
  1. POImage upload to DropBox server via it's core api giver error in iOS
    primarykey
    data
    text
    <p>I am using DropBox core api OAuth 2.0 authentication and I am trying to upload UIImage via it's core api </p> <p><a href="https://api-content.dropbox.com/1/files/" rel="nofollow">https://api-content.dropbox.com/1/files/</a>/ </p> <p>found at <a href="https://www.dropbox.com/developers/core/docs" rel="nofollow">https://www.dropbox.com/developers/core/docs</a> ( /files (POST) )</p> <p>my code is</p> <pre><code>-(void)uploadData:(NSData *)imageAsData and:(NSString *)fileName{ NSString *urlString=[NSString stringWithFormat:@"https://api-content.dropbox.com/1/files/dropbox/Apps?access_token=%@",dropBoxToken]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *boundary = @"---------------------------14737809831466499882746641449"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"Content-Disposition: attachment; name=\"attachement\"; filename=\"%@\";",fileName] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[NSData dataWithData:imageAsData]]; [body appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; [request setHTTPBody:body]; NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding]; NSLog(@"returnString=%@",returnString); </code></pre> <p>where imageAsData in NSData of a image and fileName is "abc.jpg".</p> <p>output of returnString is {"error": "file parameter value 'None' is invalid"}</p> <p>I don't know why this problem occurs please help me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload