close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Attachment Woes With FB File Form Element in UE

Thread began 10/21/2009 7:31 pm by paputxi | Last modified 10/28/2009 12:53 pm by Jason Byrnes | 3643 views | 14 replies |

paputxi

Attachment Woes With FB File Form Element in UE

I recently worked through a problem I was having with attaching files to an email where I had created a File Field form element directly into the form using Dreamweaver rather than via Form Builder. (Thanks, Jason, for that.) However, I now seem to have a problem with receiving an attached file where I used Form Builder to create the file form element.

To simplify the problem I am having, enclosed are files associated with a very simple form of just two fields, one a text field and the other the file to be uploaded. I followed the same steps I had used earlier (i.e., from "How To Include Attachments with your Email form" and I did create a folder named "attachments" at the same level at the test1.php file on my website and I did make sure that I had set the attachments folder online to have read-write permission (a big problem I had earlier and from what others have experienced from reading similar emails. That probably should be added as a "Tip" or "Hint" to the future publications of the paper for clarification, particularly for those of use that are still newbies to all this.)

Anyway, I did try using similar "die" coding that Jason had provided me with my earlier problem, but I get a blank screen every time. So, I must not be incorporating the code correctly.

Any thoughts on how to figure out what I need to do to correct this problem are greatly appreciated. Thanks in advance.

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

Jason ByrnesWebAssist

On line 25 of the WA_Universal_Email/WAUE_test1_1.php file, I can see that you have only selected the serverDirectory for the attachment:



php:
$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]  ."");




double click the Universal Email server behavior. On attachments tab, select the code that is already there for the server directory and copy it. Then click thye lightning bolt and select the server file name name.

Place your cursor at the beginning of the server file name code and paste the server directory code.


When you are done, line 25 should look like:

php:
$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]  ."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."");
Sign in to reply to this post

paputxi

Jason, after correcting the mistake it still doesn't work. I'm including the code for your review.

I am wondering if the validation on the file field is somehow causing the problem. When I created the file field in FB, I did not indicated that I wanted validation, i.e., I left the required checkbox unchecked. However, in the example I provided it shows that a file IS required and, if I don't select a file, it tells me I need to select one. So, it is validating that field even though I did not request it nor want it to be validated. Just a thought, but in any case I need to find out how to get the validation removed from that file field in addition to getting a file uploaded.

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

Jason ByrnesWebAssist

To remove validation, in the Server Behaviors list, select the Server Validation server behavior and click the Minus button to remove it.

To trouble shoot the upload, change line 25 in the WAUE_test1_1.php file:

php:
$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]  ."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."");





to:

php:
die("".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]  ."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."");

$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]  ."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."");
Sign in to reply to this post

paputxi

Hmmm. I get a blank screen after clicking the Submit button. I tried this both in Firefox and IE. I noticed this same thing yesterday when I was trying to debug similar code, which is why I ended up write to the forum. This approach did work the other day when you were helping me. So, I'm perplexed why it doesn't work now. Any thoughts??

And, BTW, thanks for tell me how to delete the validation behavior.

Sign in to reply to this post

Jason ByrnesWebAssist

hmmmm, that is strange.





lets try changing line 25 to:

php:
die(WA_DFP_AllUploadsDebug());

$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]  ."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."");




also add:

php:
<?php

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




at line 1 of the test1.php page.

Sign in to reply to this post

paputxi

OK, the results are below. I know I can write into the "attachments" folder as I also created a test2.php file in this same website, where I used DW rather than FB to create the file field and it works ok.

Status object: WA_UploadResult1
statusCode : 0
errorMessage : No file uploaded
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileWasOverwritten :
fileWasSkipped :
fileWasRenamed :
fileSize : -1
isImage :
imageWidth : -1
imageHeight : -1
WA_UploadResult1_1:
clientFileName :
fileExtension :
serverFileName :
serverSimpleFileName :
serverDirectory :
contentType :
fileSize : -1
imageWidth : -1
imageHeight : -1
statusCode : 0
errorMessage : No file uploaded

Sign in to reply to this post

Jason ByrnesWebAssist

Ughh. I was missing the forest for the tree's.

The forms encoding type needs top be changed to multipart/form-data.

change:

html:
<form class="NewFromBlank_Default" id="Default_NewFromBlank_Default" name="Default_NewFromBlank_Default" method="post" action="test1.php">





to:

html:
<form action="test1.php" method="post" enctype="multipart/form-data" name="Default_NewFromBlank_Default" class="NewFromBlank_Default" id="Default_NewFromBlank_Default">
Sign in to reply to this post

paputxi

All that did was to remain on the form. It left the value I had in the Info field, but cleared the file field. The form was never submitted as I never got any email.

Note: I did not remove the "die" or additional PHP coding you had me enter earlier. Also, I deleted the validation per your earlier comment. I was hoping that would make a difference but it didn't.

Sign in to reply to this post

Jason ByrnesWebAssist

can you send the most recent version of your page so I can take a look at the currant state of the code.

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