Jump to content


Photo

upload script help


  • Please log in to reply
1 reply to this topic

#1 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 04 September 2006 - 03:25 AM

hey i'm working on a public upload site and for some reason it just says "There was an error uploading the file, please try again!" whenever i try to upload something


// Where the file is going to be placed 
$target_path = "images/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
$_FILES['uploadedfile']['tmp_name'];  

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}

and this is the form that leads to that
<form enctype="multipart/form-data" action="photoparse.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>

?? i checked everything i think...



#2 marker5a

marker5a
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 04 September 2006 - 03:41 AM

I believe that the path you are going to upload it to has to include also the file name.

// Where the file is going to be placed 
$target_path = "images/image_name.jpg";

Hope it helps






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users