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
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
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
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
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
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
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.
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
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
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
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
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
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
: 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
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
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
16 matches
Mail list logo