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
> 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.
>
> 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
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 image
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
pro
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
6 matches
Mail list logo