1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley

Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

Renaming file Uploads

Friday October 27, 2006
When you allow file uploads it is a good idea to rename them as they come in to prevent accidentally overwriting files because they have the same name. This script shows you how to rename them to a random number or a timestamp before they are saved to the server.

Comments

November 15, 2006 at 7:12 pm
(1) Tone says:

I’m having problems adding the “limiting files by size” and “restricting certain file types” code to this “Renaming file Uploads” code. What’s happening is if i try to upload a file with a wrong extention, even though the error message comes up in the browser it’s still getting uploaded and renamed on the server.

May 5, 2007 at 12:30 pm
(2) Skipper says:

This was really helpful in producing a screenshot database, thanks a load!!

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore PHP / MySQL

More from About.com

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

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

All rights reserved.