close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Digital File Pro Update Page not uploading file.

Thread began 9/13/2009 3:36 pm by sandy170299 | Last modified 9/14/2009 3:50 pm by anonymous | 4479 views | 6 replies |

sandy170299

Digital File Pro Update Page not uploading file.

Digital file pro is working on the insert page, but not the update page. It is not uploading the file, nor is it writing to the database. This is my code:

<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../leftImages/",
'FileName' => "[FileName]",
'DefaultFileName' => "".$row_WADAcontent['photo'] ."",
'ResizeType' => "2",
'ResizeWidth' => "150",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "photo", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>
<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $ec;
$WA_table = "content";
$WA_redirectURL = "content_Results.php";
$WA_keepQueryString = false;
$WA_indexField = "ID";
$WA_fieldNamesStr = "pageContent|pageTitle|menuName|sortOrder|extID|photo";
$WA_fieldValuesStr = "".((isset($_POST["pageContent"]))?$_POST["pageContent"]:"") ."" . "|" . "".((isset($_POST["pageTitle"]))?$_POST["pageTitle"]:"") ."" . "|" . "".((isset($_POST["menuName"]))?$_POST["menuName"]:"") ."" . "|" . "".((isset($_POST["sortOrder"]))?$_POST["sortOrder"]:"") ."" . "|" . "".((isset($_POST["extID"]))?$_POST["extID"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|none,none,NULL|none,none,NULL|',none,''";
$WA_comparisonStr = "=|=|=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".$row_WADAcontent['ID'] ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_ec;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>

I am also receiving an error upon submit. The error is:

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\EC\admin\adminheader.php:15) in C:\xampp\htdocs\EC\admin\content_Update.php on line 109
Update Record

I am using an included header and footer file. The header file is named adminheader.php.

Sign in to reply to this post

anonymous

Hi Sandy,

A couple of suggestions...

First, try to get that headers already sent error fixed first as that may be the only real issue. This error is 9 times out of 10 caused by "white space" between PHP tags that are above the HTML.

For example, this would cause the problem:

<?php

(pretend there is a bunch of code in here

?>

<?php ?>

Notice the space between two - so I would go through all of your includes that are above the HTML and insure that where one PHP tag ends, the next PHP tag begins immediately... you can even put the closing tag and the new opening tag on the same line next to each other to be sure, like this:

?><?php ...

On my second suggestion, I would modify your default file. I notice you are populating it with a database field... but remember, the DFP behavior is waiting for a form trigger so it actually occurs when the page reloads and that data field may have changed... so on your update page, I would create a hidden field that first get the output from the database and then make your default file become the output of the POST variable from the form to be sure that the default file is being set correctly.

Cheers,

Brian

Sign in to reply to this post

sandy170299

Hi, Brian. I'm not sure I'm following you.

On my second suggestion, I would modify your default file. I notice you are populating it with a database field... but remember, the DFP behavior is waiting for a form trigger so it actually occurs when the page reloads and that data field may have changed... so on your update page, I would create a hidden field that first get the output from the database and then make your default file become the output of the POST variable from the form to be sure that the default file is being set correctly.

What are you referring to by the default file? Are you referring to my included header file?

Sign in to reply to this post

anonymous

In your code, you'll see this line:

'DefaultFileName' => "".$row_WADAcontent['photo'] ."",

I am guessing that $row_WADAconente['photo'] is coming for your recordset. I am saying instead of populating in that matter, add a hidden field in your form that receives that value before updating, so in your form you will have something like this:

<input type="hidden" name="imagefile" value="<?php echo $row_WADAcontent['photo']; ?>">

Then, you will change that default file name value in your code to this:

'DefaultFileName' => "".$_POST['imagefile'] ."",

You will actually be able to set this value, as well, by double clicking the DFP server behavior and using the dialogue box on the second page... you will see the lightning bolt beside the default file field and from there you will want to select the form's hidden field.


That way, you default file will be generated at the same time as the form and then passed through as a form variable.

Sign in to reply to this post

sandy170299

Actually, I just started moving pieces of code around, including the "included" files, and it appears to be working now. I'm a ColdFusion programmer who is just starting to work with PHP and I've learned pretty quickly that PHP is pretty picky about where you put stuff :)

Sign in to reply to this post

anonymous

Originally Said By: sandy170299
  Actually, I just started moving pieces of code around, including the "included" files, and it appears to be working now. I'm a ColdFusion programmer who is just starting to work with PHP and I've learned pretty quickly that PHP is pretty picky about where you put stuff :)  




Glad to hear it is working... I, too, use to program ColdFusion exclusively so I can relate to where you are at with it... all I can say is just hang in there... I actually found that PHP is now easier for me (I thought I would never say that) and I also found the costs for PHP to be much more appealing than CF.

Sign in to reply to this post

Jimmy Wu

Glad to see you got it working. If you have any additional issues feel free to make a new thread.

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