|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
storing to db via form + optional image upload
hi experts,
i am referring to this thread by bokeh entitled "How to: Upload images using PHP". i want to achieve a solution where one can add a news item to a mysql db and optionally attach a picture too. so i modified the upload.form.php and added 2 more form fields: "headline" and "text". next i edited upload.processor.php so that additionally the values of the fields "headline" and "text" as well as the location of the uploaded image on the server get stored in a mysql table. that works perfectly as long as there is a picture attached and it doesnīt exceed the $max_file_size. since i want to make the image upload optional i tried some if-else statements in upload.processor.php to avoid getting errors when there is no pic attached. no surprise to me that none of my attempts worked so iīm kindly asking for your help to achieve something like this: PHP Code:
any ideas? thanks in advance, jogol
__________________
free music: comatronic |
|
#2
|
||||
|
||||
|
PHP Code:
|
|
#3
|
|||
|
|||
|
thanks
__________________
free music: comatronic |
|
#4
|
|||
|
|||
|
use my solution... i thinh that the best way.. affter i read many upload image php + image name stored in data mysql
notices that i have ask for some one help me here for that .. but mostly no one find out my problems in my scripts.. at the end i found my selft ( that stupid bugs) i just forget to put the ( enctype="multipart/form-data" ) in the form .. read my post and put this one in.. all will work.. explain : you can call the funtion uploadimg() any time .. like $nameimagewillstoreindata=@uploadimg() then you can store the $nameimagewillstoreindata affter you call it.. .. the convenian is this php script only one file.. http://www.webdeveloper.com/forum/sh...d.php?t=117029 now i trying to use it as muti uploader with ajax... if anyone have solution please help me..thanks ragards.. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|