Results 1 to 2 of 2

Thread: move_uploaded_file - not working?

  1. #1

    Thread Starter
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    move_uploaded_file - not working?

    Code:
    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...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: move_uploaded_file - not working?

    uhh. you can not do this:
    PHP Code:
        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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width