close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

File Upload and Update not inserted into database, is uploaded to directory

Thread began 1/31/2012 9:53 am by toni272059 | Last modified 1/31/2012 2:48 pm by toni272059 | 2357 views | 6 replies |

toni272059

File Upload and Update not inserted into database, is uploaded to directory

I have added File Upload to DataAssist Upload and Update pages. Forms are working with the database -- I have tested with Updating text content.

When I try to upload an image file in the Update page the image form field goes blank and the page is not redirected.

However the image is being uploaded into the correct directory but is not being added to the database and not showing on the Detail page (obviously).

I have run through Adding DFP to DA Insert and Upload pages twice and no success.

I am attaching ZIP with the DataAssist generated pages and the helperphp.php file

Note: Images I inserted manually into the database do appear in the Detail page image area. See attached JPEG

Thanks!

Attached Files
DFP.zip
Sign in to reply to this post

Jason ByrnesWebAssist

it sounds like an error is occurring, but you have display errors disabled.


change:
ini_set('display_errors','0');


to:
ini_set('display_errors','on');


so we can see any errors that are occurring, this will help us determine what the problem is.

Sign in to reply to this post

toni272059

I found the error display code on another forum post!

Anyway, changed and the following error came up when I tried to Update an existing Product by uploading an image.

screen-grab-update.jpg attached.

The new images have been uploaded to the directory

ERROR MESSAGES
Notice: Undefined index: WA_UploadResult1 in /Users/tonimills/Sites/Boomerang_Needleworks/bn_admin/adminUpdate.php on line 114

Warning: Cannot modify header information - headers already sent by (output started at /Users/tonimills/Sites/Boomerang_Needleworks/bn_admin/adminUpdate.php:71) in /Users/tonimills/Sites/Boomerang_Needleworks/bn_admin/adminUpdate.php on line 140

CODE FROM LINE 114
$WA_fieldValuesStr = "".((isset($_POST["group_id"]))?$_POST["group_id"]:"") ."" . "|" . "".((isset($_POST["product_number"]))?$_POST["product_number"]:"") ."" . "|" . "".((isset($_POST["item_name"]))?$_POST["item_name"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["item_desc"]))?$_POST["item_desc"]:"") ."" . "|" . "".((isset($_POST["item_size"]))?$_POST["item_size"]:"") ."" . "|" . "".((isset($_POST["item_price"]))?$_POST["item_price"]:"") ."";

CODE FROM LINE 140
header("Location: ".$WA_redirectURL);

Insert New Product
I tried to Insert new product information and text, same problem/error messages. Screen grab attached. I also tried to Insert a new product without including an image. Same problem. (Images are not required by the database.)
Attachments: screen-grab-insert-with-image.jpg
screen-grab-insert-no-image.jpg

Sign in to reply to this post

Jason ByrnesWebAssist

this code:

$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]


is referring to an upload object that does not exist.

this code:

php:
<?php

// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
    
'UploadFolder' => "../images/",
    
'FileName' => "[FileName]_large",
    
'DefaultFileName' => "",
    
'ResizeType' => "2",
    
'ResizeWidth' => "500",
    
'ResizeHeight' => "",
    
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult2_1 End
// WA_UploadResult2_2 Start
$WA_UploadResult2_Params["WA_UploadResult2_2"] = array(
    
'UploadFolder' => "../images/",
    
'FileName' => "[FileName]_small",
    
'DefaultFileName' => "".((isset($_POST["item_photo"]))?$_POST["item_photo"]:"")  ."",
    
'ResizeType' => "4",
    
'ResizeWidth' => "270",
    
'ResizeHeight' => "270",
    
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult2_2 End
// WA_UploadResult2 Params End
?>



is creating the $WA_DFP_UploadStatus["WA_UploadResult2"] object, but the insert and update behaviors are referring to the $WA_DFP_UploadStatus["WA_UploadResult1"] object.


did you add 2 upload behaviors to the page, then remove one? that's about the only way I could see that happening.

Sign in to reply to this post

toni272059

Yes, I went thru the setup instructions twice and then deleted the first. I see I missed one setting that needed changing from 1 to 2. $WA_DFP_UploadStatus["WA_UploadResult2"]

I have now done a global search on the Update and Insert pages for UploadResult and made sure all are UploadResult2

Now I am getting just one error message when I try to Update a record by uploading an image. update-page-error.jpg

Warning: Cannot modify header information - headers already sent by (output started at /Users/tonimills/Sites/Boomerang_Needleworks/bn_admin/adminUpdate.php:71) in /Users/tonimills/Sites/Boomerang_Needleworks/bn_admin/adminUpdate.php on line 140

Line 140
header("Location: ".$WA_redirectURL);

The image is uploading into the directory. However the jpeg file name disappears from the form field when I click Update button and the page does not redirect. However the image does now appear on the Detail page though in very poor quality considering it did not need to be resized. detail-page.jpg

Sign in to reply to this post

Jason ByrnesWebAssist

the error means there is output between php tags.

see the following page for details:
showthread.php?t=19285


in the file upload behavior, you have left the default file setting for the main image blank, only the resized image has a default file setting. you need to bind the main images default file to the hidden form element.

Sign in to reply to this post

toni272059

That was it, empty lines between closing and opening php tags!!!!!

Also, thanks for tip on image settings.

Now to continue and see what my next challenge will be....

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...