Re: [PHP-DB] upload images
[email protected] (3dgtech)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
It could work, but be careful using timestamp or the php equivalent - microtime since this is reliant on gettimeofday(). If naming conventions don't mandate a sterilized format I woul still recommend using a "confirmed" new variable. Just my two cents :-) Eli On May 30, 2010, at 10:04 PM, Karl DeSaulniers <[email protected]> wrote: > Very good point. I did not think of that. > Change it from time() to the date + time() w/ seconds. Every second > changes. Or better yet, milliseconds. Since that is the speed the > script runs in I believe. > > That should work. Yes? > > Karl > > Sent from losPhone > > On May 30, 2010, at 6:57 PM, 3dgtech <[email protected]> wrote: > >> The problem with time() is that fast servers are too fast! (you >> will have processed multiple files before time() changes.) Add the >> $i from the for loop in multiple images to the end of your filename. >> >> >> On May 30, 2010, at 4:33 PM, Karl DeSaulniers >> <[email protected]> wrote: >> >>> Try this >>> Try assigning time() to a variable then add that to the rename. >>> >>> EG: >>> >>> if ($_FILES['foto']['type'] == "image/jpeg" || >>> $_FILES['foto']['type'] == "image/pjpeg"){ >>> //nombre de la imagen >>> $timestamp = time(); >>> //movemos la imagen. >>> move_uploaded_file($_FILES['foto']['tmp_name'], >>> "../fotografias/".$timestamp.".jpg"); >>> >>> HTH, >>>> >>> >>> Karl DeSaulniers >>> Design Drumm >>> http://designdrumm.com >>>