Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: uploading a file with the same name

by katgirl (Hermit)
on Jul 24, 2002 at 14:13 UTC ( #184846=note: print w/replies, xml ) Need Help??


in reply to uploading a file with the same name

Thank you all for your suggestions! I used amphiplex's suggestion, with a small alteration:
$num=""; while(-e "$Data/$category/$num$imagename"){ $num++; } $imagename = $num.$imagename;
That works great (although the other suggestions would have worked just as well, but I believe in KISS!) I'll have a look at merlyn's column once my brain has stopped being jelly-like...

Replies are listed 'Best First'.
Re: Re: uploading a file with the same name
by amphiplex (Monk) on Jul 24, 2002 at 14:25 UTC
    Nice to hear that :), even though my answer was partly wrong (not the code, I hope, but the part about yours checking for foo0)

    ---- amphiplex
Re: Re: uploading a file with the same name
by shotgunefx (Parson) on Jul 29, 2002 at 08:06 UTC
    One thing to look out for is that if you are expecting lots of images and usage , most 'NIXs do linear scans of directories, meaning that with a lot of images, it can get very, very slow. If you ever used Cache::FileCache you might notice the way it uses digests of the names (for fairly random distribution) and splits the storage into sub-directories. /dir/a/ab/abcd/abcdefghijk.gif

    If you don't expect that kind of usage, I would just go the simple route. You can always modify it later. (Though if people are linking to this stuff, you might want to think about it now.)

    -Lee

    "To be civilized is to deny one's nature."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://184846]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2018-07-16 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (335 votes). Check out past polls.

    Notices?