problems with uploading files

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am having issues with trying to upload files to a directory on my  
server.  the first script is the form the second is the upload file, it  
just doesnt identify the file path where it is being uploaded from.

Any ideas?

<form action="getFiles.php" method="get"><br>
Type (or select) Filename: <input type="file" name="uploadFile">
<input type="hidden" name="MAX_FILE_SIZE" value="25000" />
<input type="submit" value="Upload File">

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

I just cant see what is wrong.  Please help.



Re: problems with uploading files

Quoted text here. Click to load it

a case of the missing cipher...or three ;-)
looks odd around these two lines:
Quoted text here. Click to load it
first you set it to "../slices/";
then you overwrite that with the basename...
maybe you want '.=' rather than just '='

Re: problems with uploading files


another problem you might have here is your <form> tag.
Normally you use:

<form action="getFiles.php" enctype="multipart/form-data" method="post">

if you create an input field for a file upload. Without the enctype
declaration it might not work.


Glenn Coyle wrote:
Quoted text here. Click to load it

Site Timeline