in reply to uploading a file with the same name
Hi katgirl,
Yes this would work pretty fine. You could use -s instead of -e because most likely you want the file to be overwritten when it's empty. But I usually give the people who want to upload it a message then and ask them to use another name, because in lots of cases people also want to download their files again, and when there are 10 files a la test1.pl test5.pl etc. people might start to wonder which one theirs was.
Another good way is, if you have a username or something to hang the username at the end of the filename before counting numbers up, but that depends on the kind of usage you have for your script...
Oh yea and you could make this one a bit more obfuscating with $imagename = $imagename.++$num;
giant
Yes this would work pretty fine. You could use -s instead of -e because most likely you want the file to be overwritten when it's empty. But I usually give the people who want to upload it a message then and ask them to use another name, because in lots of cases people also want to download their files again, and when there are 10 files a la test1.pl test5.pl etc. people might start to wonder which one theirs was.
Another good way is, if you have a username or something to hang the username at the end of the filename before counting numbers up, but that depends on the kind of usage you have for your script...
Oh yea and you could make this one a bit more obfuscating with $imagename = $imagename.++$num;
giant
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: uploading a file with the same name
by frankus (Priest) on Jul 24, 2002 at 13:51 UTC | |
Re: Re: uploading a file with the same name
by katgirl (Hermit) on Jul 24, 2002 at 13:54 UTC |
In Section
Seekers of Perl Wisdom