You are here: Re: newbie with multiple images upload question « PHP Programming Language « IT news, forums, messages
Re: newbie with multiple images upload question

Posted by guywmustang on 12/28/06 03:25

Well, you can setup your database to have it auto-increment an ID
field.

Then just have it use your move_uploaded_file function as you've done.
If that's successful, just do a simple mysql statement:

$query = "INSERT INTO <dbname> ('id','filename') values ( '', $name);
mysql_query($query);

That's about it.

As far as each file having a unique id... not too much way to do it,
other than like adding a number to the end of the filename, or
possibly... creating a text/xml file which stores an id for each file &
then parsing it out into an array. Just use the database for that if
it's really necessary.

On Dec 27, 3:49 pm, angelduran2...@hotmail.com wrote:
> hi i have this code
> foreach ($_FILES["images"]["error"] as $key => $error) {
> if ($error == UPLOAD_ERR_OK) {
> $tmp_name = $_FILES["images"]["tmp_name"][$key];
> $name = $_FILES["images"]["name"][$key];
> move_uploaded_file($tmp_name, "images/$name");
> }
>
> }and i wish to add it a uniqid to every file uploaded leaving intact
> it's original name as well. and i would also need to get the file name
> and add it to my database. just wondering how to do that if any one can
> help.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация