Helping ordinary people create extraordinary websites!

How To Upload Files Using PHP

By Ben Sinclair
2005-04-11

How To Upload Files Using PHP
OK, so you want to upload an image or file to your server without using your FTP? This is very simple. This tutorial will teach you how!

The Form

First of all you need to create your form to select the file you wish to upload:

form.php
<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
File: <input type="file" name="file" size="30">
<input type="submit" value="Upload!">
</form>


One thing a lot of people forget is this: ENCTYPE="multipart/form-data". If that is not there, it will not work. I've forgotten it before and it took me over half an hour to work out why the script wasn't working...



Tutorial pages:
 3 Votes

You might also want to check these out:


Leave a Comment on "How To Upload Files Using PHP"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS