Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Change file name on upload

Avatar of jeremyBass26
jeremyBass26Flag for United States of America asked on
ProgrammingJavaScriptPHPRegular Expressions
15 Comments1 Solution1599 ViewsLast Modified:
Hello I need to change this script so I can have a dynamic name... the script is from here

http://www.ronniesan.com/articles/jquery-multiple-file-upload.php

I have made all my other changes as needed but I can't seem to change the name of the file.  I want the file to be like such when put in the folder..

2893_Photo.jpg

but I only get the real name.  "2893" is the dynamic part, and I'm sure I can figure that out once i figure out how to correctly change the name, proble need to put a post or something.  Any help here would be great thank you

Jeremy



// JQuery File Upload Plugin v1.4.3 by RonnieSan - (C)2009 Ronnie Garcia
if (!empty($_FILES)) {
	$tempFile = $_FILES['Filedata']['tmp_name'];
	$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
	$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
	
	// Uncomment the following line if you want to make the directory if it doesn't exist
	// mkdir(str_replace('//','/',$targetPath), 0755, true);
	
	move_uploaded_file($tempFile,$targetFile);
}
echo '1'; // Important so upload will work on OSX
ASKER CERTIFIED SOLUTION
Avatar of jeremyBass26
jeremyBass26Flag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 15 Comments.
See Answers