> Lowell Allen wrote:
> 
>> 
>> Try using $HTTP_POST_FILES['uploadedFile']['name'] instead. I wasted a bunch
>> of time yesterday with an upload script that did not recognize files when
>> using "$_FILES", but worked fine with "$HTTP_POST_FILES" -- PHP 4.3.4 on
>> Linux.
>> 
> Thank you for the suggestion.  Unfortunately, it didn't resolve the
> issue.  Still getting the warning AND the rename function works.  Odd
> indeed...
> 
> Thanks,
> Roger
> 
OK, well how about this -- you said your code is:

$rename = time();
$old_name = $_FILES['uploadedFile']['name'];
$read_extension = explode(".", $old_name);
$ext = $read_extension[1];
$new_name = $rename.".".$ext;
rename($old_name, $new_name);

And your error message is "rename() failed (No such file or directory)", but
isn't $_FILES['uploadedFile']['name'] the original file name before
uploading, whereas $_FILES['uploadedFile']['tmp_name'] is where the file was
uploaded to on the server. So the first is just a name, and the second is
the file location.

Also, you're defining what $new_name is before you even use rename(), so
even if rename() fails, you've set the desired value for $new_name. But what
you have not done is actually move the uploaded file. If it's being uploaded
to /tmp, it will be deleted when your script ends.

So, I think you need to pass rename parameters that are file locations.

HTH

--
Lowell Allen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to