i have this script that is meant to move a file from one folder to another but i get an error,:
$photo= $_POST['camera']; // i.e. 45647.jpg
//move file to userpics/ folder
rename ("../uploads/$photo", "../userpics/$photo");
but i get this error:
Warning: rename(/uploads/1czcec43s.jpg\n,/userpics/1czcec43s.jpg\n) [function.rename]: No error in .. on line 24
Your filenames are containing linebreaks
\n. This may well be the source of the error. Try callingtrim:Also, for goodness sake add some sanity checking to your code. Your user could easily put
web/index.php(for instance) as the contents of$_POST['camera']and overwrite your PHP file.