Renaming a file that a user uploads to site?


Posted on 16th Feb 2014 07:03 pm by admin

My site allows for registered users to upload images to the site under their own gallery. Currently it just leaves the file named as however the person has it named. But what I would like to do is something another site does, which is rename the files when the user uploads them. An example of how I would like it done:
A user whose username is "I Like Cheese" uploads a file named "whatever.jpg", but in the uploading form, they title the upload "Dog In the Rain". I`d like like "whatever.jpg" to be renamed to "Dog In the Rain_by_I Like Cheese.jpg" upon the upload process and use that new filename for the database information.

How would I tell the system to rename the image file in that manner?

No comments posted yet

Your Answer:

Login to answer
225 Like 41 Dislike
Previous forums Next forums
Other forums

Record count of entire database
Does anyone know if there is a way to obtain the number of records in each table of the database usi

Change image filetype on upload?
Hi,
I've got a form which uploads an image to the server.
Is it possible to change the image t

matching numbers inside ( )
I know I can match numbers by just [0-9]+, so I thought matching numbers inside ( ) would be somethi

Problem with umlauts and UTF-8
Hello every1,

I'm creating my own little CMS at the moment and got some problems with the cha

Output Buffering question
Hi all,

I've been trying to wrap my head around output buffering. So far I've found tons of

Revoking alter any table from a schema
Hi All,

i am working in Oracle 10g.
my requirement is to revoke all kind of DDL oper

Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want

Deleted Delivery but material wont return
We deleted a delivery but the material its still pending.

We made a reverse goods movemen

pageination not working right... coping images over 4 pages
Code: <?php //This code will obtain the required page number from the $_GET array. Note that

Function to extract email attachments using PHP IMAP
function extract_attachments($connection, $message_number) {

$attachments = array();

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash