Welcome to WebmasterWorld Guest from 188.8.131.52 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Rename file name before upload mcnika msg:3602659 7:40 am on Mar 17, 2008 (gmt 0) Hi. I need PHP code, that will let me rename file, when upload it to an exactly folder.I mean when i choose the file that i'll upload it, it must change the name and then upload it.
Habtom msg:3602678 7:49 am on Mar 17, 2008 (gmt 0)
If you have the copy function somewhere on your upload script, you can rename the file as you copy it.
mcnika msg:3602734 10:07 am on Mar 17, 2008 (gmt 0)
Suppose that you have "flower.jpg" image in the folder. I click on Browse and choose image with the same name "flower.jpg" and click submit.The code must check if there is a such file on the folder, if yes rename it and upload. The checking code I've already written. The function that you wrote would help me if I'd like to change the name of the first image. phranque msg:3602737 10:14 am on Mar 17, 2008 (gmt 0)
welcome to WebmasterWorld [ webmasterworld.com], mcnika!
you cannot change the name of a file before you upload it.
when you upload a file the script must create a file and write the uploaded data to the file.
you can name the newly created file anything you like when you create it... Habtom msg:3602762 10:28 am on Mar 17, 2008 (gmt 0)
The function that you wrote would help me if I'd like to change the name of the first image.
if yes rename it and upload
Are you trying to name the existing file, if there the new file is having the same file name as the one already in the server?
Habtom msg:3602765 10:33 am on Mar 17, 2008 (gmt 0)
PHP manual Rename [ php.net]