renaming upload file to be a name...

User 2808808 Photo

Registered User
1 post

I need a simple file to be uploaded and renamed to be the typed field.

so if I have a box for the user to type in a number then make that number the name of the file they uploaded
User 187934 Photo

Senior Advisor
19,678 posts
Online Now

Hi JD,
Here's a quick example

$image_name = $_POST['inputname'];
$extension = end(explode(".", $_FILES["photo"]["name"]));
$directory = 'myphotos';
if (!file_exists('../'.$directory)) {
mkdir('../'.$directory, 0777, true);
'../'.$directory.'/'.$image_name.'.'.$extension );
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
This is a site I built for use in my job.(HTML Editor)
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.