1. Home
  2. Computing & Technology
  3. PHP / MySQL

Renaming PHP Uploads

By , About.com Guide

1 of 4

Uploading the file

Previously in our script allowing files to be uploaded from the browser and saved to the hosting via PHP, we mentioned it was possible to rename the files to something random to prevent people uploading files with the same name and overwriting each other's files. In this script we will explore that further.
<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
The first thing we must do, is allow the user to upload a file. We can do that by placing this HTML on any page we want to allow them to upload from. This code is in a file separate from our PHP. It points to a file called upload.php, however if you save your PHP by a different name you should change it here.
Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Advanced PHP
  5. Rename File Upload PHP - Rename PHP Upload - Change Upload Name PHP

©2009 About.com, a part of The New York Times Company.

All rights reserved.