PDA

Click to See Complete Forum and Search --> : move_uploaded_file - not working?


Static
Jul 14th, 2009, 11:52 AM
if ($_FILES['screenshot']['error'] > 0) {
echo 'Error: ' . $_FILES['screenshot']['error'] . '<br />';
}else {
$u_img = $temp.$usr.'.png';
echo 'New Filename: ' . $u_img . '<br />';
$img = $temp.basename($_FILES['screenshot']['name']);
echo 'Uploaded: ' . $img . '<br />';

echo "Type: " . $_FILES["screenshot"]["type"] . "<br />";
echo "Size: " . ($_FILES["screenshot"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["screenshot"]["tmp_name"] . " <br />";

if( move_uploaded_file($phpbb_root_path.$_FILES['screenshot']['tmp_name'],$img )) {
echo 'The file '. $u_img . ' has been uploaded<br />';
}else{
echo "There was an error uploading the file, please try again!";
}
}


i think its the paths... the php temp dir is /tmp

here is the output of the code:

New Filename: generator/temp/Static.png
Uploaded: generator/temp/Wallpaper.png
Type: image/png
Size: 45.6708984375 Kb
Stored in: /tmp/phpv4PjL3
There was an error uploading the file, please try again!

the generator folder + all sub dirs are set to 777 so i know its not that...

kows
Jul 14th, 2009, 02:44 PM
uhh. you can not do this:
if( move_uploaded_file($phpbb_root_path.$_FILES['screenshot']['tmp_name'],$img )) {
$_FILES['screenshot]['tmp_name'] stores the full path of the temporary filename; you can see this in the output you have. just remove $phpbb_root_path off of it.