When I POST some images to my server using:
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setShouldStreamPostDataFromDisk:YES];
[request setData:image withFileName:@"file(0)" andContentType:@"image/jpg" forKey:fileString];
[request setData:image withFileName:@"file(1)" andContentType:@"image/jpg" forKey:fileString];
[request setData:image withFileName:@"file(2)" andContentType:@"image/jpg" forKey:fileString];
[request startAsynchronous];
How do I catch this in a PHP script?
I was doing
for($i = 0; $i<$imageCount; $i++){
$target_path = "files/";
$target_path = $target_path . basename( $_FILES['file($i)']['name']);
if(move_uploaded_file($_FILES['file($i)']['tmp_name'], $target_path)) {
echo "Image: ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "error uploading";
}
}
with imageCount the total number of images being sent POSTed in a different variable to the server, but this throws me upload errors each time.
Solution: