PHP and uploading files

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

Threaded View

Hello all,

    Ok ok, I have searched the internet extensively and I cannot find
the answer to this.  I have found many answers but none of which that
work.  I am running an apache server on my end, local for testing, and
I have wrote a php page that will accept a file to be uploaded.  See

<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
          <span class="smHeader">Choose a file to upload: </span></td>
        <td><input name="uploadFile" type="file" />

Then on the added.php file that I post to, I have

if ($_POST["password"] == "")  // Blank for now so I don't have to
type it everytime.  Btw, is this secure???
    $last = $_POST["last"];
//local file will be replaced when posted
    echo "Made it! ". $_FILES['uploadFile']['name'];
    if ( move_uploaded_file ($_FILES['uploadFile']
['tmp_name'],"../uploads/{$_FILES['uploadFile'] ['name']}")  )
         print '<p> The file has been successfully uploaded


Notice the echo "Made it!".$files line.  It posts the made it part but
nothing for the file.  Now I created a ../uploads folder (which is in
the root, correct?  I never could get the . or .. stuff right).  But
it just will not work.  Is it because I am running the server local?
Shouldn't be...  Or is it something with the php.ini config or apache
config?  Please help.  This is really annoying...



Re: PHP and uploading files

Quoted text here. Click to load it

Is your form set up correctly - enctype="multipart/form-data"

The name of the file won't be in $_POST, either.  It will be in


Hywel /

Solution Found:Re: PHP and uploading files

Thank you very much!  I did try the multipart thing and that didn't
work last time.  Now it does.  Have NO idea as to why... lol.

Thanks for the help!


On Sat, 24 Sep 2005 11:26:14 +0100, Hywel Jenkins

Quoted text here. Click to load it

Site Timeline