THOUSANDS OF FREE BLOGGER TEMPLATES

Jumat, Agustus 15, 2008

PHP - File Upload: HTML Form

PHP - File Upload: HTML Form

Before you can use PHP to manage your uploads, you must first build an HTML form that lets users select a file to upload. See our HTML Form lesson for a more in-depth look at forms.

HTML Code:



Choose a file to upload:



Here is a brief description of the important parts of the above code:

  • enctype="multipart/form-data" - Necessary for our to-be-created PHP file to function properly.
  • action="uploader.php" - The name of our PHP page that will be created, shortly.
  • method="POST" - Informs the browser that we want to send information to the server using POST.
  • input type="hidden" name="MA... - Sets the maximum allowable file size, in bytes, that can be uploaded. This safety mechanism is easily bypassed and we will show a solid backup solution in PHP. We have set the max file size to 100KB in this example.
  • input name="uploadedfile" - uploadedfile is how we will access the file in our PHP script.

Save that form code into a file and call it upload.html. If you view it in a browser it should look like this:

Display:

Choose a file to upload:

After the user clicks submit, the data will be posted to the server and the user will be redirected to uploader.php. This PHP file is going to process the form data and do all the work.

1 comments:

Anonim mengatakan...

You should be able to use your PHP script with an upload applet to support multiple files and directories upload.

Radio Jogja

Navigation Bar

OpenOffice.org 2

Chinese Zodiac

Enter your birth year. For example: "1975"


URL Input Box Javascript

Bandwidth Converter

Subscribe Now: myy

Subscribe Now: gator

Subscribe in NewsGator Online

Subscribe Now: google

Add to Google Reader or Homepage

Subscribe Now: rojo

Subscribe in Rojo

Subscribe Now: myaol

Add to My AOL

Subscribe Now: feedlounge

Subscribe in FeedLounge

Subscribe Now: netvibes

Add to netvibes

Subscribe Now: bloglines

Subscribe in Bloglines

Subscribe Now: freedictionary

Add to The Free Dictionary

Subscribe Now: bitty

Subscribe Now: plusmo

Add to Plusmo

Subscribe Now: newsalloy

Subscribe in NewsAlloy

Subscribe Now: excitemix

Add to Excite MIX

Subscribe Now: netomat

Add to netomat Hub

Subscribe Now: fwicki

Add to fwicki

Subscribe Now: flurry

Add to flurry

Subscribe Now: webwag

Add to Webwag

Subscribe Now: attensa

Add to Attensa

Subscribe Now: zaptxt

Receive IM, Email or Mobile alerts when new content is published on this site.

Subscribe Now: odeo

Add Technically the Computer and the Network to ODEO

Subscribe Now: podnova

Subscribe in podnova

Subscribe Now: podcastready

Subscribe Now: pageflakes

Add to Pageflakes

The series of the Practice of Electronics Headline Animator

Koleksi music Rio chrisandi Headline Animator

riochrisandi's Photobucket media Headline Animator

Clock

Music Fm

FIREFOX 2

Super-Duper Virtual Disco Ball

Super-Duper Virtual Disco Ball


Iklan Adsense