PHP Function Lookup:
PHP Quick Start
PHP Installation
PHP Articles
PHP Scripts

Top Rated Articles 
  • Simple Ad Rotator
  • PHP and Cookies
  • Getting Screen resolution using JavaScripts & PHP
  • Using Functions in PHP
  • PHP Sessions

  • Site Related
    Submit Articles/Code
    Contact Us

       Home                   Article Added on: April 13, 2002
    PHP File Uploads

    Overview: In this article we will show you how simple it is to upload File from the browser.

    Uploading a file is a very simple process, To upload a file to a Web server via an HTML form interface, we will be performing the following tasks.

  • First we create a HTML form (upload_form.htm)

  • Create an PHP script (upload_file.php) that actually uploads the file!

    Creating the HTML Upload form

    upload_form.htmView Sample Output

    Note that in the form tag we use the enctype="multipart/form-data" attribute so that the browser knows that more than just text variables are coming at it.

    We also have a hidden feild with the name name="MAX_FILE_SIZE" which set's the maximum file size in bytes that can be uploaded.

    Now that we have the HTML form we create upload_file.php which actually uploads the file.

    For Windows based machine you have modify the path click here to get the windows example code file.

    Common Error's The most common error is caused because write permissions are not set for the upload directory. In the above example assumes that you have the upload with proper write permissions.
    Rate this article:  Current Rating: 2.86
      Poor    Excellent     
              1     2    3    4    5


    Home | Privacy Policy | Contact Us | Terms of Service
    (c) 2002 - 2018 Unauthorized reproduction/replication of any part of this site is prohibited.