HokieTracks Posted May 30, 2009 Share Posted May 30, 2009 Hi, I was not too sure where this topic should go so sorry if it is in the wrong forum. But, I have a code for users to upload avatars. But, I don't want a user accidentally overwriting another users avatar. So I was thinking that instead of using the original file name I could use the temporary file name when I move it. So, are temporary file names ever the same? Link to comment https://forums.phpfreaks.com/topic/160313-temporary-upload-files-ever-the-same/ Share on other sites More sharing options...
Michdd Posted May 30, 2009 Share Posted May 30, 2009 Just save it as your own unique id. You can use the auto incrementing primary key in the table, so it'll never repeat. Link to comment https://forums.phpfreaks.com/topic/160313-temporary-upload-files-ever-the-same/#findComment-845978 Share on other sites More sharing options...
HokieTracks Posted May 31, 2009 Author Share Posted May 31, 2009 Ignore this, stupid response. Thanks for the answer. Link to comment https://forums.phpfreaks.com/topic/160313-temporary-upload-files-ever-the-same/#findComment-845992 Share on other sites More sharing options...
monkeytooth Posted May 31, 2009 Share Posted May 31, 2009 could always save the file as username_timestamp.(gif|jpg|bmp) can't get more unique then that.. I do something similar with the users on one of my sites, kept running into issues with people uploading stuff with ' or other char's unacceptable so I just started saving there uploaded files to there user name and either a timestamps, or there session identifier or something. In the end, its something that I cant foresee anyone ever running into the same file name more then once. Link to comment https://forums.phpfreaks.com/topic/160313-temporary-upload-files-ever-the-same/#findComment-846157 Share on other sites More sharing options...
monkeytooth Posted May 31, 2009 Share Posted May 31, 2009 mind you I also user a database to track the files, which files belongs to who... Link to comment https://forums.phpfreaks.com/topic/160313-temporary-upload-files-ever-the-same/#findComment-846159 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.