|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php5 - Multi picture upload script
Hi,
I'm trying to create a multi picture upload script. Idea behind is that you can make a new topic on some small news system and upload few pictures with it that will then get displayed in news article. It all works fine, title and body along with poster name get stored into db. Problem comes when pictures added to news via upload are not getting added to their respective folder. For example: /Pic/$News_Id/All pictures added. That's because News_Id is set after news article is added to the db. Is there any other way to go arround this? Or are there other ways to deal with it? Thanks in advance. |
|
#2
|
||||
|
||||
|
other than changing the way the site stores the images, or using ajax, if your news_id is an auto incremented number...and there are not multiple people uploading at the same time. you could use a sql query to get the last id number, add one to id and create the directory structure that way...
__________________
When I die, I want to go peacefully like my Grandfather did, in his sleep -- not screaming, like the passengers in his car. |
|
#3
|
|||
|
|||
|
I've found out how to do it. After the INSERT query add this:
PHP Code:
The value of mysql_insert_id() is affected only by statements issued within the current client connection. It is not affected by statements issued by other clients. So after the query run the pic upload while / for loop and there you go. Neat function. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > php5 - Multi picture upload script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|