![]() |
Image rename upon upload of duplicate file name?
Quote:
I've tried this, which i thought would work but didnt: [quote] $imageFileType rename(2.'$imageFileType'); [quote] :helpme |
Quote:
|
1. Rename all files on upload for security, control and so you don't get dupes in the first place.
2. No idea about the clickable thing, since as usual you don't explain things properly. How are you viewing it, in a directory index listing, hrefs, img src, something else? |
Quote:
Quote:
|
What about just prepending uniqid() to the start or end of the existing filename?
|
Quote:
The files are effectively renamed when you upload anyway, when they're in the tmp directory, and when you move them from tmp you're 'renaming' them back to the original name, so instead you just pick a new unique name that you control that won't clash. Anyway, if there's still some reason you can't do that, here's a basic code illustrating renaming of an uploaded file only if it exists. Save it as a PHP file and try it. Obviously change $up_dir to whatever you're using. Code:
<?php |
All times are GMT -7. The time now is 12:33 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123