Softpedia
 


SCRIPTS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Koken 0.8.2
  • ContentBox 1.5.2
  • jQPlayer 0.5.2
  • SPOILER ALERT! 0.0.2
  • jQuery Mask Plugin 0.9.0
  • Easing Slider 2.1.2
  • Btapp.js 0.2.0
  • WiiFlash 0.4.5
  • Breeze.js 1.3.3
  • TinyMCE Templates 3.0.2
  • Home > Scripts > Snippets

    Upload File

    Download button


    Downloads: 610  Tell us about an update
    User Rating:
    Rated by:
    Good (3.3/5)
    22 user(s)
    Developer:

    Website:

    License / Price:

    Platforms:

    Databases:

    Language:

    Last Updated:

    Category:
    PHP Snippet Db | More scripts
    php.snippetdb.com
    GPL - GNU Public License 

    Windows / Linux / BSD
    MySQL
    PHP
    July 31st, 2006, 14:13 GMT
    C: \ Snippets

     Read user reviews (0)  Refer to a friend  Subscribe

    Upload File description

    Upload File - Simple example that shows how to upload a file using PHP.

    Both the form and the data processer are on the same page. Configure the upload path and the max file size as per your requirements.

    Source Code

    // basic php file upload example
    // http://php.snippetdb.com

    if ($_POST['upload']){ 
    //process uploaded file
        
    $uploadDir '/path/to/upload/directory/'
    //file upload path
        
    $uploadFile $uploadDir $_FILES['uploadfile']['name'
    ];
        echo 
    "

    "; 
        if (
    move_uploaded_file($_FILES['uploadfile']['tmp_name'], $uploadFile
    ) )
        {
            echo 
    "File is valid, and was successfully uploaded. "
    ;
            echo 
    "Here's some more debugging info:"
    ;
        }
        else
        {
            echo 
    "ERROR!  Here's some debugging info:"
    ;
            echo 
    "remember to check valid path, max filesize"
    ;
        }
        
    var_dump($_FILES
    );
        echo 
    "
    ";
        
    } else { 
    //display upload form
    ?>
    echo $_SERVER['SCRIPT_NAME']?>" method="post">
        
        

      
        

        

    }
    ?>



    TAGS:

    Upload File | upload snippets | php snippets | Upload | File | php

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM