Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: uploading a file with the same name

by Abigail-II (Bishop)
on Jul 24, 2002 at 13:51 UTC ( [id://184837]=note: print w/replies, xml ) Need Help??


in reply to uploading a file with the same name

That would be a very, very bad way of dealing with this problem. If two people want to upload a file with the same name at the same time, you will get problems as your program doesn't run atomically.

Keep a counter in a database, or a properly locked file and use that.

Abigail

  • Comment on Re: uploading a file with the same name

Replies are listed 'Best First'.
Re: Re: uploading a file with the same name
by PhiRatE (Monk) on Jul 25, 2002 at 08:05 UTC
    Or use the process ID as a portion of the name, ie image-$PID-$INCREMENTING_COUNTER, that should do the trick. So long as the operation is atomic within the PID it'll be fine (which it is).
      Not necessarely. For instance if you are using a threaded webserver in combination with mod_perl. Whether each thread inside the same process get its own PID depends on the OS.

      Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 00:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found