I just recently moved my local MAMP installation to my live Ubuntu EC2 server and I'm having a devil of a time accessing file uploads. Everything looks like it should be working okay, but I don't know why it's not. I have a max upload of 5MB in in the php.ini, which should be plenty for uploading photos, so I know that's not it. Haven't changed the default directory, but thinking maybe I should as the domain's on an Apache virtual host with 2 other domains? I don't want to go this route in my php scripts:
ini_set('upload_tmp_dir','/your-home-www/tmp/');
but will, if it's absolutely necesary for the virtual host to process the files. I'm pretty sure it's not my code, as it works flawlessly on my localhost MAMP installation but here's the snippet of code that processes the photos if it helps:
$fileTmpLoc = $photo["tmp_name"];
$fileSize = $photo["size"];
if (!$fileTmpLoc) { // if file not chosen
sendResponse(404,"ERROR: Photo not sent.");
exit;
} else if($fileSize > 5242880) { // if file size is larger than 5 Megabytes
unlink($fileTmpLoc); // Remove the uploaded file from the PHP temp folder
sendResponse(413, "ERROR: Your file was larger than 5 Megabytes in size.");
exit;
} else {
$newName = "image01.jpg";
$moveResult = copy($fileTmpLoc, "members/$id/".$newName);
if ($moveResult != true) {
@unlink($fileTmpLoc);
sendResponse(404,"ERROR: File not uploaded. Try again.");
exit;
}
....
}
Now, it makes it all the way down to sendResponse(404,"ERROR: File not uploaded. Try again.");, so maybe it has nothing to do with the tmp file, but it is still not uploading. And the members directory and the $id directory for the user are both set to 777, so I literally have no clue what's going on. This is coming from an IOS client, not an html form