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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Having trouble configuring insert page to upload a file

Thread began 8/25/2014 1:01 pm by mouse426912 | Last modified 8/27/2014 11:23 am by Jason Byrnes | 2332 views | 14 replies |

mouse426912

Having trouble configuring insert page to upload a file

Hi, I am using Dreamweaver and DataAssist to set up an area for my client to upload a newsletter. I have used DataAssist successfully before but have not used the Upload feature. On the insert page I followed the instructions found at http://www.webassist.com/tutorials/Apply-file-upload-or-download. I uploaded the pages and the webassist files but when I go to view the files, the results and details pages are fine but the insert page with the upload field is blank. What am I doing wrong?

Thanks
Mouse

Sign in to reply to this post

Jason ByrnesWebAssist

a blank page means that a php error is occurring but error reporting is turned off.

to turn error reporting on, add the following code at line 1:

<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>



once we know what the error is, we will be able to troubleshoot the cause.

Sign in to reply to this post

mouse426912

Thanks - Here is the error:

Parse error: syntax error, unexpected '[' in /var/www/vhosts/mchnantucket.org/httpdocs/webassist/file_manipulation/helperphp.php on line 74

Sign in to reply to this post

mouse426912

Sorry - should have added - here is line 74 from the indicated file:

if (is_uploaded_file($_FILES[$fileField]['tmp_name'][$x])) $fileArray[] = ['tmp_name'=>$_FILES[$fileField]['tmp_name'][$x],'name'=>$_FILES[$fileField]['name'][$x],'type'=>$_FILES[$fileField]['type'][$x],'size'=>$_FILES[$fileField]['size'][$x]];

Sign in to reply to this post

Jason ByrnesWebAssist

here's an updated copy of the webassist/file_manipulation/helperphp.php file to fix the error

Attached Files
helperphp.php.zip
Sign in to reply to this post

mouse426912

Progress is being made

Thanks - that got things going. I'm sure though that I have configured something(s) incorrectly. The pdf file has been uploaded to the correct directory but it is not appearing in the database.

One thing, I configured this to upload when clicking the submit button - should it upload when the insert button is pressed? I am attaching the insert page file.

Thanks very much for your help.
Mouse

Attached Files
newsletter_insert.php
Sign in to reply to this post

Jason ByrnesWebAssist

1) there are 2 instances of the upload server behavior, this code:

<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End?>
<?php
// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
'UploadFolder' => "/News/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "Pdf", "0", "", "false", $WA_UploadResult1_Params);
}?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult2");
if(isset($_POST["Submit"]) || isset($_POST["Submit_x"])){
WA_DFP_UploadFiles("WA_UploadResult2", "upload", "2", "[NewFileName]_[Increment]", "false", $WA_UploadResult2_Params);
}
?>




should have only one instance:

<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "Pdf", "0", "", "false", $WA_UploadResult1_Params);
}?>




2) That code for the uplaod behavior needs to be at line 7 so that it comes before the insert.

Sign in to reply to this post

mouse426912

Still the same problem - the pdf uploads to the folder but does not appear in the database. Title does appear in the database. I'm attaching the edited file.

I'm appreciating your timely responses.
Thanks

Attached Files
newsletter_insert.php
Sign in to reply to this post

Jason ByrnesWebAssist

the upload code:

<?php
// WA_UploadResult2 Params Start
$WA_UploadResult2_Params = array();
// WA_UploadResult2_1 Start
$WA_UploadResult2_Params["WA_UploadResult2_1"] = array(
'UploadFolder' => "/News/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult2_1 End
// WA_UploadResult2 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "Pdf", "0", "", "false", $WA_UploadResult1_Params);
}?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult2");
if(isset($_POST["Submit"]) || isset($_POST["Submit_x"])){
WA_DFP_UploadFiles("WA_UploadResult2", "upload", "2", "[NewFileName]_[Increment]", "false", $WA_UploadResult2_Params);
}
?>




should be:

<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "Pdf", "0", "", "false", $WA_UploadResult1_Params);
}?>
Sign in to reply to this post

mouse426912

Still the same problem. Uploads to folder but not to database. Title is in the db but not the pdf filename.

I will not be able to work on this more today - will check back tomorrow - I may try to regenerate the page.

Sign in to reply to this post
loading

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