close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using With Dreamweaver 8 Insert Record Server Behavior

Thread began 4/29/2009 5:48 pm by visser.ha378346 | Last modified 5/01/2009 9:25 am by Ray Borduin | 4623 views | 8 replies |

visser.ha378346

Using With Dreamweaver 8 Insert Record Server Behavior

Can someone assist me with how I can implement the DFP with using Dreamweaver 8's Insert Record Server Behavior.

My problem:
Image will not upload to the folder, but the record will insert in the db table
Image filename is not recorded in db field

CODE:
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["undefined"])){
WA_DFP_UploadFile("WA_UploadResult1", "image", "", "../../images/team/", "[FileName]", "2", "[FileName]_[Increment]", "0", "true", "59", "60");
}
?>

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO gymnast_links (company, link, image) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['company'], "text"),
GetSQLValueString($_POST['link'], "text"),
GetSQLValueString($_POST['image'], "text"));

FORM:
<tr valign="baseline">
<td nowrap align="right">Image:</td>
<td><input name="image" type="file" id="image" />
(your image height should be no more than 60px) </td>
</tr>
<input type="hidden" name="MM_insert" value="form1">
<input name="image" type="hidden" id="image" />

Thank you!

Sign in to reply to this post

Ray BorduinWebAssist

Make sure the upload code appears above the insert record code and that problem will be solved.

DW8's insert record server behavior doesn't allow you to update a column from anything other than a form field and it doesn't work with upload fields, so you need to edit code by hand to get this to work properly.

You can probably add a hidden form element to your page and bind the form name to that hidden field, then write code that sets the $_POST variable for that hidden field to be the name of the uploaded field before the dreamweaver insert code runs to get around that limitation.

Sign in to reply to this post

visser.ha378346

OK. The code is above the Insert Record Server Behavior

"DW8's insert record server behavior doesn't allow you to update a column from anything other than a form field and it doesn't work with upload fields, so you need to edit code by hand to get this to work properly.

You can probably add a hidden form element to your page and bind the form name to that hidden field, then write code that sets the $_POST variable for that hidden field to be the name of the uploaded field before the dreamweaver insert code runs to get around that limitation."

I guess you're going to need to help me with baby steps at this point.

Sign in to reply to this post

Ray BorduinWebAssist

Really I would suggest getting DataAssist, which allows you to update a field with any value from any source not just directly from a form.

To use the DW Insert, you would:

1) add a hidden form element to the page
2) bind the update to the value of the hidden form element
3) in between the code that uploads the file and the code that inserts, add code:

<?php
$_POST['HiddenFormElementName'] = {server file name value from bindings};
?>

Sign in to reply to this post

visser.ha378346

Unfortunately the cost is beyond the finances.

Sign in to reply to this post

visser.ha378346

Originally Said By: Ray Borduin
  Really I would suggest getting DataAssist, which allows you to update a field with any value from any source not just directly from a form.

To use the DW Insert, you would:

1) add a hidden form element to the page
2) bind the update to the value of the hidden form element
3) in between the code that uploads the file and the code that inserts, add code:

<?php
$_POST['HiddenFormElementName'] = {server file name value from bindings};
?>  



OK. I have:
1) <input name="cc_img" type="hidden" id="cc_img" />
2) WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["submit"])){
WA_DFP_UploadFile("WA_UploadResult1", "cc_img", "../../images/nophoto/No-Phot-Available.jpg", "../../photos/community_connections/", "[FileName]", "2", "[FileName]_[Increment]", "30", "true", "141", "119");
}
3) $_POST['cc_img'] = {server file name value from bindings};
**I don't understand what goes between the brackets.** Sorry. I'm a complete NEWBIE!

Sign in to reply to this post

Ray BorduinWebAssist

Look in the bindings tab and drag and drop the value that says "server file name" for the upload. You should replace the brackets and the text inside with the code you drag and drop from the bindings tab.

Sign in to reply to this post

visser.ha378346

One more thing:

When I attempt to use the Upload in an Update Record Server Behavior using the same instructions provided above, I get a 'headers already sent' error message. Is using DFP with an Update Record Server Behavior need to be modified differently?

Sign in to reply to this post

Ray BorduinWebAssist

You probably have a space or blank line in your server code. That is usually the cause of that error.

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...