Skip to content

Instantly share code, notes, and snippets.

@codesynapse
Last active December 20, 2015 05:59
Show Gist options
  • Select an option

  • Save codesynapse/6082642 to your computer and use it in GitHub Desktop.

Select an option

Save codesynapse/6082642 to your computer and use it in GitHub Desktop.

Revisions

  1. codesynapse revised this gist Jul 25, 2013. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions send.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>File Upload Example</title>
    </head>
    <body>
    <form method="post" action="upload.php" enctype="multipart/form-data">
    <label> Upload your file</label><br/>
    <input type="file" name="file" id="file"><br/>
    <input type="submit" name="submit">
    </form>
    </body>
    </html>
  2. codesynapse created this gist Jul 25, 2013.
    25 changes: 25 additions & 0 deletions upload.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>File Upload Status</title>
    </head>
    <body>
    <?php
    //by using $_files array you can store data from client computer to the remote server
    //check if the file is uploaded, if not then pass the error
    if($_FILES['file']['error']>0) {

    echo 'Error :'.$_FILES['file']['error']."<br/>";
    }
    //if the file is uploaded successfully, echo the file size, type and location
    echo "Upload ". $_FILES['file']['name']."<br/>";
    echo "Type ". $_FILES['file']['type']."<br/>";
    echo "Size ".($_FILES['file']['size']/1024) ."<br/>";
    echo "Stored in :".$_FILES['file']['tmp_name']."<br/>";



    ?>
    </body>
    </html>