Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: uploading a file with the same name

by amphiplex (Monk)
on Jul 24, 2002 at 13:49 UTC ( #184834=note: print w/replies, xml ) Need Help??


in reply to uploading a file with the same name

This will not do what you want.
suppose you want to upload the file foo and the file already exists. Your code would check for foo0, which propably does not exist, and overwrite foo.

Besides, you append th number, giving you: foo0,foo01,foo012,....
And to concatenate strings you should use ".".

One way to do it:
$num=""; while(-e "$Data/$category/$imagename$num"){ $num++; } $imagename = $imagename.$num;

---- amphiplex

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2018-07-22 18:50 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 (455 votes). Check out past polls.

    Notices?