Skip to content

Instantly share code, notes, and snippets.

@taterbase
Created May 13, 2012 15:03
Show Gist options
  • Select an option

  • Save taterbase/2688850 to your computer and use it in GitHub Desktop.

Select an option

Save taterbase/2688850 to your computer and use it in GitHub Desktop.

Revisions

  1. taterbase revised this gist May 13, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion upload.php
    Original file line number Diff line number Diff line change
    @@ -23,4 +23,5 @@
    } else{
    echo "There was an error uploading the file, please try again!";
    }
    }
    }
    ?>
  2. taterbase created this gist May 13, 2012.
    26 changes: 26 additions & 0 deletions upload.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <!DOCTYPE html>
    <html>
    <head>
    <title>Upload your files</title>
    </head>
    <body>
    <form enctype="multipart/form-data" action="upload.php" method="POST">
    <p>Upload your file</p>
    <input type="file" name="uploaded_file"></input><br />
    <input type="submit" value="Upload"></input>
    </form>
    </body>
    </html>
    <?PHP
    if(!empty($_FILES['uploaded_file']))
    {
    $path = "uploads/";
    $path = $path . basename( $_FILES['uploaded_file']['name']);

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