How to Allow Users to Upload Files to My Website
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
Open a text or HTML. Type the following data to create the file browser form:Save your HTML file (for example "uploadfile.html").
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.
Save the file and upload them to your server. Test your page by navigating to the web page and using the form.