|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
PHP-Ben Rowe's GD Ex.- need to insert into DB after upload
Noobe here,
Having a problem with inserting GD created images into the db. My form will allow for multiple updates (one image at a time, or up to 5 at a time), so I can't hard-code any db field names into the action script, only the input form. After submission, the form redirects to self. The form will then show a thumbnail version of the image(s) and allow for the user to delete the image if/when desired. The uploaded image is tracked by a hidden field "pic1" in the form. I am using the GD library to resize the uploaded image, and then create a thumbnail. After which the script inserts the path to the thumbnail into the db. Right now it's inserting the uploaded (large) image into field "pic1" I would like to be able to insert the path of the generated thumbnail image into the db field "tnpic1". The code I think in question is: PHP Code:
$image_stored" is the large picture. i know I can swap $image_stored for the thumbnail, but I still have the problem of the large image not being inserted. Either way, i need to get BOTH images into the db using $HTTP_POST_FILES. How could I go about doing this? if you need more information , please don't hesitate to ask! The full PHP script is attached. Thanks in advance ![]() Last edited by tgavin : February 22nd, 2003 at 08:44 AM. |
|
#2
|
|||
|
|||
|
I'm confused... I'm looking in the script, but I don't see any INSERT statements for your db.
Also, what's the layout of the database table where you're inserting the details?
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
This is how the data is being inserted
PHP Code:
I have a hidden field in my form called "upload_path" with the value "photos/". This script is working with Adobe GoLive to do the inserts - I think this is the problem. I would rather bypass GoLive (if I can) and just have the script insert the paths to both pictures into the fields "pic1" and "tnpic1". The DB layout is basically: userID int(11) unsigned NOT NULL auto_increment, username varchar(25) NOT NULL default '', pic1 varchar(100) NOT NULL default '', tnpic1 varchar(100) NOT NULL default '', PRIMARY KEY (userID), Thanks! |
|
#4
|
|||
|
|||
|
Quote:
Hmm... Not sure I understand still... Can GoLive actually perform DB inserts? Maybe I'm overlooking something... |
|
#5
|
|||
|
|||
|
GoLive can perform db inserts, updates, deletions... you name it, it can pretty much do it. It's a great tool. Of course at times it's limited.
Here's the form action: Code:
<form action='../config/actions/mysql.actions6.php?<?php echo URLArgs(array())?>' method="post" name="picture_upload" enctype="multipart/form-data">
<input type="hidden" name="upload" value="now">
<input type="hidden" name="strWidth" value="100">
<input type="hidden" name="strHeight" value="100">
<input type="hidden" name="upload_path" value="photos/">
<input type="hidden" name='userID(<?php echo $users->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($users->Value("userID")) ?>'>
<input type="hidden" name='pic1(<?php echo $users->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($users->Value("pic1")) ?>'>
<input type="hidden" name='tnpic1(<?php echo $users->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($users->Value("tnpic1")) ?>'>
<input type="file" name="pic1" size="16"></div>
<a href='<?php echo mapPath($users->Value("pic1"), "../")?>' target="_blank">
<img src='<?php echo mapPath($users->Value("pic1"), "../")?>' alt="" height="75" width="100" border="1"></a>
<input type="checkbox" name="delete_pic[pic1]" value="pic1"> <b>Delete</b>
<input type="submit" value="Edit Picture 1" name="_SubmitChanges" <?php SetupMySQLUpdate("picture_uploadtest.php", '$return', $users) ?>>
<?php SetupMySQLForm($users); ?>
</form>
I attached the GoLive runtime library, in case you're curious. ![]() I appreciate you taking a look at this! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP-Using Ben Rowe's GD Example-Insert after uploading |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|