View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Getting File Upload to work

Thread began 1/13/2010 1:25 pm by jay.malik396220 | Last modified 1/13/2010 7:46 pm by jay.malik396220 | 3634 views | 7 replies

jay.malik396220

Getting File Upload to work

My action code is in a separate file, and I've tried to move code as best as I can guess.

The file upload is not working as a consequence. I will also have an issue adding the attachment to email as a second item.

Here's the form code:

<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once( "../../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Customer Access")){
WA_Auth_RestrictAccess("accessdenied.php");
}
require_once("../../WA_DigitalFilePro/HelperPHP.php");
//WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
//WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../uploads",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmln
.
.
.
<form enctype="multipart/form-data" action="processsupportrequest.php" method="post" name="form1" class="FormContent" id="form1">
.
.
<tr>
<td>Attachments:</td>
<td><span id="sprytextfield6">
<input name="upload" id="upload" type="file"/>
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>

Here's the processing code:
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
require_once('../../Connections/Centerline.php'); ?>
<?php require_once("../../WA_DigitalFilePro/HelperPHP.php"); ?>
<?php require_once("../../WA_Universal_Email/mail_PHP.php"); ?>
<?php require_once("../../WA_Universal_Email/MailFormatting_PHP.php"); ?>
<?php

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();

if ($securimage->check($_POST['captcha_code']) == true) {
// capthca entered correctly

WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
WA_DFP_UploadFiles("WA_UploadResult1", $_FILES["upload"], "3", "[ExistingFileName]_[Increment]", "false", $WA_UploadResult1_Params);

//WA Universal Email object="mail"
//Send Loop Once Per Entry
$RecipientEmail = "support@centerlinesft.com";include("../../WA_Universal_Email/WAUE_processsupportrequest_1.php");

//Send Mail All Entries
header("Location: ");

$insertGoTo = "thankyouemail.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
else {
print '<p align="center" style="color: #DD0000; font-weight: bold;">Incorrect verification code</p>';
print '<p align="center"><a href="javascript:history.go(-1);">Go back and try again</a></p>';
}
?>
</body>
</html>

And the email template:
<?php
$MailAttachments = "";
$MailBCC = "";
$MailCC = "";
$MailTo = "";
$MailBodyFormat = "";
$MailBody = "";
$MailImportance = "";
$MailFrom = "Centerline Support Page|WA|support@centerlinesft.com";
$MailSubject = "Support Request - " . $_POST["Name"];
$_SERVER["QUERY_STRING"] = "";

//Global Variables

$WA_MailObject = WAUE_Definition("mail.allabuzz-ci.com","25","support@centerlinesft.com","","","");

if ($RecipientEmail) {
$WA_MailObject = WAUE_AddRecipient($WA_MailObject,$RecipientEmail);
}
else {
//To Entries
}

//Attachment Entries

//BCC Entries

//CC Entries

//Body Format
$WA_MailObject = WAUE_BodyFormat($WA_MailObject,0);

//Set Importance
$WA_MailObject = WAUE_SetImportance($WA_MailObject,"3");

//Start Mail Body
$MailBody = $MailBody . "<html><head></head><body>\r\n";
$MailBody = $MailBody . "\r\n";
$MailBody = $MailBody . "<p>Name: ";
$MailBody = $MailBody . ((isset($_POST["Name"]))?$_POST["Name"]:"");
$MailBody = $MailBody . "</p>\r\n";
$MailBody = $MailBody . "<p>Email: ";
$MailBody = $MailBody . ((isset($_POST["Email"]))?$_POST["Email"]:"");
$MailBody = $MailBody . "</p>\r\n";
$MailBody = $MailBody . "<p>Comments: ";
$MailBody = $MailBody . ((isset($_POST["Comments"]))?$_POST["Comments"]:"");
$MailBody = $MailBody . "</p>\r\n";
$MailBody = $MailBody . "<p>Attachment: ";
$MailBody = $MailBody . ((isset($_FILES["upload"]))?$_FILES["upload"]:"");
$MailBody = $MailBody . "</p>\r\n";
$MailBody = $MailBody . "</body></body></html>";
//End Mail Body

$WA_MailObject = WAUE_SendMail($WA_MailObject,$MailAttachments,$MailBCC,$MailCC,$MailTo,$MailImportance,$MailFrom,$MailSubject,$MailBody);

$WA_MailObject = null;
?>

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