Rename generates level 2 warning but works
From: Roger Spears (roger_at_bgnet.bgsu.edu)
Date: 12/31/03
- Next message: Raditha Dissanayake: "Re: [PHP] PHP and MSSQL (and Access????)"
- Previous message: Ed Seedhouse: "Re: PHP and MSSQL (and Access????)"
- Next in thread: Lowell Allen: "Re: [PHP] Rename generates level 2 warning but works"
- Reply: Lowell Allen: "Re: [PHP] Rename generates level 2 warning but works"
- Reply: Danny Anderson: "4.2.2 doesn't have mysql_real_esacpe_string()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Dec 2003 10:29:48 -0500 To: PHP General <php-general@lists.php.net>
Hello,
I have this magical script which uses rename. A visitor to the site
uploads a file and I want to rename it to a timestamp. Oddly enough,
the rename() function actually works, it renames the file AND then
generates a level 2 warning:
Error code: 2
Error message: rename() failed (No such file or directory)
Why does it work AND create a warning?
Here's the snippet of code:
$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);
I know I can suppress the the warning with @, but I'm more interested in
WHY this warning gets generated. I'm using PHP 4.2.2 on a Linux box.
Any hints or suggestions are greatly appreciated...
Thanks,
Roger
- Next message: Raditha Dissanayake: "Re: [PHP] PHP and MSSQL (and Access????)"
- Previous message: Ed Seedhouse: "Re: PHP and MSSQL (and Access????)"
- Next in thread: Lowell Allen: "Re: [PHP] Rename generates level 2 warning but works"
- Reply: Lowell Allen: "Re: [PHP] Rename generates level 2 warning but works"
- Reply: Danny Anderson: "4.2.2 doesn't have mysql_real_esacpe_string()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|