Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 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."
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://184846]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2018-10-22 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (119 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!