Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 81,417 times

Contents

Related Categories

Uploading files in PHP - Introduction

S.S. Ahmed

Introduction

Think of an application where you want your users to upload files to your machine. Uploading files in PHP is very easy. You can upload any type of file from client to server.

Files are uploaded from the browser using an <input> tag, with the type parameter in the <input> tag set to "File". This is supported by all popular browsers currently available on the market. The important thing is to set the ENCTYPE attribute of the form to "multipart/form-data" and set the form's action element to the file upload page. The file upload page will handle the file uploading.

The code is on the next page

S.S. Ahmed is a senior IT Professional and works for a web and software development firm. Ahmed is a Microsoft Office SharePoint Server MVP. Ahmed specializes in creating database driven dynamic web sites. He has been working with SharePoint for the last 3-4 years. He develops customized SharePoint solutions. Ahmed likes to hop into other tools as well. Ahmed has used Project Server, InfoPath and BizTalk. Ahmed enjoys travelling and has been to many parts of the world. Web: www.walisystems.com Blog: www.sharepointblogs.com/ssa

Comments

  • Re: [2892] Uploading files in PHP

    Posted by CarlBe on 28 Sep 2006

    I am trying to allow people to upload image files and post them to me.


     


    I have copied your code exactly but get the following;


    Parse error: parse erro...

  • can the form change the filename as it is uploaded

    Posted by tpwalker1980 on 12 Jun 2005

    Is there anyway to change the filename as it is uploaded? So myhouse.jpg is auto changed to file1.jpg

    For instance, anytime a file is uploaded via the form... Have it name the file MYFILE.jp...

  • permission change of uploaded file

    Posted by lenilachica on 04 Feb 2005

    gud day!
    i have problems regarding the file i uploaded on the server.

    the file is pic.bmp

    i uploaded it in "subs/images"
    then i am about to create an exec statement to convert this logo.

    it...

  • change/set permissions on upload

    Posted by mike00 on 29 Jan 2005

    Hi,

    I'm relatively new to php. I'm using a code simliar to the one posted for file uploads. I was wondering if there was any way to set the permisson to "read only" upon upload. I've been having pr...

  • root address

    Posted by lenilachica on 28 Jan 2005

    how can i get the exact address of the uploaded file i browsed.

    like when i browsed it from "C:/picture.bmp"

    how can i get this address? i mean how could i get these exact words?

    and when ...