How to Allow Users to Upload Files to My Website

By Willa Dunn

A website that allows for interaction in some way provides a richer experience for visitors. File upload capability enables your users to place their content on your site. This may be useful in the case of a classified or video sharing site for instance. Use PHP and an HTML file browser form to allow users to upload files to your website.

Things You'll Need

  • HTML or text editor
  • PHP-enabled server

Step 1

Open a text or HTML. Type the following data to create the file browser form:

Choose File:
Save your HTML file (for example "uploadfile.html").

Step 2

Create the "uploadfile.php" PHP file noted in the "action" parameter of the above form. Type the following data in a new file:Note that the "userfile" attribute in "$_FILES" corresponds with the "name" attribute of your form. It can be whatever you like, but must be identical in both places.

Step 3

Save the file and upload them to your server. Test your page by navigating to the web page and using the form.