Log in

View Full Version : creating an upload area



jc_gmk
07-03-2007, 03:04 PM
I'm trying to create an area so that people can upload files to my server.

It doesn't need to be that secure as there will only be a select few people doing it, I will password the area.

Does anyone know of a good PHP script I can use to do this?

I have already created a form and below is the PHP script I'm using at the moment.
The problem is, it won't work because PHP safemode is enabled.
Any Ideas?



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

/* Add the original filename to the target path.
Result is "/uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_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!";
}


?>

alexjewell
07-03-2007, 07:11 PM
I'm not sure what's wrong with that code specifically, but I have another script for uploading. I'll give it you if you want?