I seem to have a bizarre error I just can't quite figure out. My website was working on one server, but when I transferred it to a new one it stopped working. I believe I've narrowed the error down to this line of code:
$ret = move_uploaded_file($tmp_name, $orig_path);
This is executed through an AJAX call so it's a little bit tricky to debug, but the script can send back an error code and then my JavaScript will alert
it. So, I've wrapped it in two of these debug statements:
echo json_encode(array(
'success' => false,
'errno' => $tmp_name.' -> '.$orig_path,
));
exit;
$ret = move_uploaded_file($tmp_name, $orig_path);
echo json_encode(array(
'success' => false,
'errno' => 'no error',
));
exit;
The first one works fine and spits out something like:
error /tmp/phpk3RICU -> /home/username/Websites/website/photos/o/2-4a3354dd017a9.jpg
Perhaps I'm a bit of a linux noob, but I can't actually find /tmp/phpk3RICU
on my system (is it deleted as soon as the script exits or what?). More on that in a sec though.
If I delete the first debug check and let move_uploaded_file
run, the 2nd debug check never seems to get executed, which leads me to believe move_uploaded_file is hanging.
If instead of using $tmp_name
I use a file I know doesn't exist, then the 2nd check DOES get executed. So... it seems like it just doesn't want to move that tmp file, but it's not reporting an error.
I'm running a fresh install of the LAMP stack on my Unbutu machine, installed through apt-get... let me know if you need more info.
Oh.. and don't know if it's relevant, but the file gets uploaded through flash.