Note that there are some explanatory texts on larger screens.

plurals
  1. PONewbie having issues with uploading a file using ASIHTTPRequest
    text
    copied!<p>I could really, really, really use some help. I have looked everywhere on some detailed documentation (for dummies) on using ASIFormDataRequest for photo uploads. Can someone through me a life line here?</p> <p>Here is what (in relevance pieces) I have though I know I may be way off.</p> <p>Camera.h</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @class ASIFormDataRequest; ... </code></pre> <p>Camera.m</p> <pre><code>#import "Camera.h" #import "ASIHTTPRequest.h" #import "ASIFormDataRequest.h" ... - (void)uploadImage:(NSData *)imageData filename:(NSString *)filename{ NSURL *url = [NSURL URLWithString:@"http://moosesightings.com/test.php"]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; // Upload a file on disk [request setData:imageData withFileName:filename andContentType:@"image/jpeg" forKey:@"userfile"]; [request setDelegate:self]; [request startAsynchronous]; } ... - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; [picker.view removeFromSuperview]; // Access the uncropped image from info dictionary UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; NSString *imageName = @"uploaded.jpg"; // Save image //UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); [self uploadImage:UIImageJPEGRepresentation(imageView.image, 1.0) filename:imageName]; captionControls.hidden = NO; [textView becomeFirstResponder]; [picker release]; } </code></pre> <p>Here is the script I have receiving it.</p> <pre><code>$dir_dest = 'uploads/'; ob_start(); print_r($_FILES); $test = ob_get_contents(); ob_end_clean(); $db-&gt;insert('connecttest', array('ts'=&gt;date('Y-m-d H:i:s'), 'tempfield'=&gt;$test))-&gt;execute(); </code></pre> <p>Here is the result I get</p> <pre><code>Array ( [(null)] =&gt; Array ( [name] =&gt; (null) [type] =&gt; (null) [tmp_name] =&gt; C:\Windows\Temp\phpCFF0.tmp [error] =&gt; 0 [size] =&gt; 0 ) ) </code></pre> <p>Please help :(</p>
 

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