Re: [PHP] asking comment

2005-04-05 Thread Richard Lynch
On Wed, March 30, 2005 5:44 am, William Stokes said: I got a bit frustrated with image upload stuff with different image name problems. So I created a system that gives the uploaded imaged a random numeric name between 1-10 000 000 and saves the file to a server folder and the image name to

[PHP] asking comment

2005-03-30 Thread William Stokes
Hello, I got a bit frustrated with image upload stuff with different image name problems. So I created a system that gives the uploaded imaged a random numeric name between 1-10 000 000 and saves the file to a server folder and the image name to mysql DB. Is there a so sort of a problem here

Re: [PHP] asking comment

2005-03-30 Thread Richard Davey
Hello William, Wednesday, March 30, 2005, 1:44:01 PM, you wrote: WS Is there a so sort of a problem here that I am not thinking of? I WS only can imagine problem that the rand() gives the same value WS twice. But I cant see this as a major problem because there would WS be maybe not more than

Re: [PHP] asking comment

2005-03-30 Thread Angelo Zanetti
use a SQL statement to check if that number exists if not then its fine if it does then generate another no and check again, until there is a unique number generated. hope this helps angelo William Stokes wrote: Hello, I got a bit frustrated with image upload stuff with different image name

Re: [PHP] asking comment

2005-03-30 Thread Frank Arensmeier
Instead of generating filenames with random numbers, why not take a timestamp and use this as filenames? /frank 2005-03-30 kl. 14.44 skrev William Stokes: Hello, I got a bit frustrated with image upload stuff with different image name problems. So I created a system that gives the uploaded

RE: [PHP] asking comment

2005-03-30 Thread Jared Williams
I got a bit frustrated with image upload stuff with different image name problems. So I created a system that gives the uploaded imaged a random numeric name between 1-10 000 000 and saves the file to a server folder and the image name to mysql DB. Is there a so sort of a problem here

Re[2]: [PHP] asking comment

2005-03-30 Thread Richard Davey
Hello Jared, Wednesday, March 30, 2005, 4:16:31 PM, you wrote: JW If want to create a unique filename, and are using PHP4.3.2 JW or better, use fopen() with the 'x' or 'x+' mode, rather than JW file_exists(). If you're happy with your scripts generating E_WARNING's all over the place then yes.

RE: [PHP] asking comment

2005-03-30 Thread Jared Williams
JW If want to create a unique filename, and are using PHP4.3.2 or JW better, use fopen() with the 'x' or 'x+' mode, rather than JW file_exists(). If you're happy with your scripts generating E_WARNING's all over the place then yes. Personally, I'm not. Use @ to surpress them. You

Re[2]: [PHP] asking comment

2005-03-30 Thread Richard Davey
Hello Jared, Wednesday, March 30, 2005, 4:51:01 PM, you wrote: If you're happy with your scripts generating E_WARNING's all over the place then yes. Personally, I'm not. JW You cannot guarentee the filename you think doesn't exist with the JW file_exists() doesn't exist when you eventually

RE: Re[2]: [PHP] asking comment

2005-03-30 Thread Jared Williams
JW You cannot guarentee the filename you think doesn't exist with the JW file_exists() doesn't exist when you eventually fopen() it, JW otherwise. Using the original posters method, I agree. But there are plenty of ways around this without forcing a warning to occur (or having to

Re[4]: [PHP] asking comment

2005-03-30 Thread Richard Davey
Hello Jared, Wednesday, March 30, 2005, 6:27:14 PM, you wrote: JW If you think you have another method please elaborate. Sure, at the base level the issue is simply the uniqueness of the filename. So there are several options open in this regard. Either use an md5'd uniqid rand combination (as

RE: Re[4]: [PHP] asking comment

2005-03-30 Thread Jared Williams
Sure, at the base level the issue is simply the uniqueness of the filename. So there are several options open in this regard. Either use an md5'd uniqid rand combination (as on the uniqid manual page) and just go with that, operating under the assumption that the chances of a

Re[6]: [PHP] asking comment

2005-03-30 Thread Richard Davey
Hello Jared, Wednesday, March 30, 2005, 7:02:58 PM, you wrote: JW I'll take absolutely bullet-proof and handled/supressed warnings, JW over relatively bullet-proof. That would be fine if your previous solution was absolutely bullet-proof, or for that matter provided a solution for the original

RE: Re[6]: [PHP] asking comment

2005-03-30 Thread Mikey
: Richard Davey [mailto:[EMAIL PROTECTED] Sent: 30 March 2005 19:19 To: php-general@lists.php.net Subject: Re[6]: [PHP] asking comment Hello Jared, Wednesday, March 30, 2005, 7:02:58 PM, you wrote: JW I'll take absolutely bullet-proof and handled/supressed warnings, JW over relatively

RE: Re[6]: [PHP] asking comment

2005-03-30 Thread Martin . C . Austin
I agree with this solution, though it only effects the OP if he is using a login system of sorts. Martin Austin Mikey [EMAIL PROTECTED] 03/30/2005 12:39 PM Please respond to frak To: php-general@lists.php.net cc: Subject:RE: Re[6]: [PHP] asking comment

RE: Re[6]: [PHP] asking comment

2005-03-30 Thread Jared Williams
JW I'll take absolutely bullet-proof and handled/supressed warnings, JW over relatively bullet-proof. That would be fine if your previous solution was absolutely bullet-proof, or for that matter provided a solution for the original problem of renaming uploaded files and keeping them