uploading different types of files mostly pdfs

Posted by Anders Kitson on Stack Overflow See other posts from Stack Overflow or by Anders Kitson
Published on 2010-05-31T19:38:22Z Indexed on 2010/05/31 19:43 UTC
Read the original article Hit count: 192

Filed under:
|

I would like to upload different types of files pressumably pdfs to a certain directory I am currently trying to get this one script working that I found on snipplr but it is not working as I assumed it would, here is my code.

<?php
if( isset($_POST['submit']) )
    {

    $target_path = "../downloads/";
    $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!";
    }

}
?>

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
        <input type="file">
        <input type="submit" name="submit" value="submit"  />
</form>

© Stack Overflow or respective owner

Related posts about php

Related posts about upload