Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>in your code why do you use setData and setFile on the same request? If you are sending large files you should use “setFile” instead of “setData”. Files are then read from disk instead of memory.</p> <p>when you are setting content type you should set the correct values.</p> <blockquote> <p>[request setFile:path withFileName:@"Image.png" andContentType:@"image/jpeg" forKey:@"file"];</p> </blockquote> <p>content type should be image/png .</p> <p>to upload an image i use this code:</p> <pre><code>// Initilize Queue [networkQueue setUploadProgressDelegate:statusProgressView]; [networkQueue setRequestDidFinishSelector:@selector(imageRequestDidFinish:)]; [networkQueue setQueueDidFinishSelector:@selector(imageQueueDidFinish:)]; [networkQueue setRequestDidFailSelector:@selector(requestDidFail:)]; [networkQueue setShowAccurateProgress:true]; [networkQueue setDelegate:self]; NSString *imagePath = [documentsDirectory stringByAppendingPathComponent:@"myImage.jpg"]; url = [NSURL URLWithString:@"http://myserver/upload.php"]; ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease]; [request setPostValue:@"myImageName" forKey:@"name"]; [request setFile:imagePath forKey:@"photo"]; [networkQueue addOperation:request]; [networkQueue go]; </code></pre> <p>Also, if you are uploading several photos at once, use setFile:forKey: rather than setData:forKey:. This way, ASIFormDataRequest will know you’re sending a fair bit of data, and it will stream the request data from a temporary file on disk, which means you don’t need to keep lots of image data in memory.</p>
    singulars
    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