Note that there are some explanatory texts on larger screens.

plurals
  1. POASIFormDataRequest + PHP Issues
    primarykey
    data
    text
    <p>I'm trying to upload a file to a server (from a custom mac os application) using ASIFormDataRequest. In my cocoa/obj-c code, I have:</p> <pre><code>- (IBAction)uploadFile:(id)sender { [networkQueue reset]; [networkQueue setShowAccurateProgress:YES]; [networkQueue setUploadProgressDelegate:progressIndicator]; [networkQueue setRequestDidFailSelector:@selector(postFailed:)]; [networkQueue setRequestDidFinishSelector:@selector(postFinished:)]; [networkQueue setDelegate:self]; ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:@"http://domain.com/to/upload.php"]] autorelease]; [request setFile:@"/path/to/file.jpg" forKey:@"file"]; [networkQueue addOperation:request]; [networkQueue go]; } - (void)postFinished:(ASIHTTPRequest *)request { NSLog(@"Post Success"); } - (void)postFailed:(ASIHTTPRequest *)request { NSLog(@"Post Failed"); } </code></pre> <p>The PHP code on the server looks like this:</p> <pre><code>$target_path = "files/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } </code></pre> <p>When I try to upload a file using this code, I get a "Post Success" response on the client end, but the file never shows up on my server. I have CHMODed the files folder to 777 just in case, but it still didn't seem to work. Does anyone have a suggestion, or see an error in the way I'm approaching this?</p> <p>Thanks!</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.
 

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