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

Renaming PHP Uploads

By , About.com Guide

4 of 4

Saving the file with the new name

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file has been uploaded as ".$ran2.$ext;
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
?>
Finally this code saves the file (with its new name) onto the server. It also tells the user what it is saved as. If there is a problem doing this, an error is returned to the user. Other features such as limiting files by size or restricting certain file types and also be added to this script if you choose.
Explore PHP / MySQL
About.com Special Features

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

Easy ways to connect two computers for networking purposes. 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.