...

View Full Version : upload file



cgibie
03-11-2006, 09:37 AM
I have this code from an online tutorial:



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

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

// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];

$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['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!";
}



I created the uploads directory, and uploaded that code to my php webhost, but I kept getting "There was an error uploading the file, please try again!"

Dale
03-11-2006, 01:24 PM
Have you CHMOD'ed the "uploads" directory to 777 ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum