close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Extension validation

Thread began 8/22/2009 6:25 am by data387485 | Last modified 8/24/2009 9:56 am by Jason Byrnes | 1879 views | 4 replies |

data387485

Extension validation

Hi,

I'm using VT to valid extension input, and have created this to testing,

<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFile("WA_UploadResult1", "file", "".((isset($_POST["file"]))?$_POST["file"]:"") ."", "files/", "[FileName]", "2", "[FileName]_[Increment]", "500", "false", "0", "0");
}
?><?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "";
$_SESSION['WAVT_index_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateFE(((isset($_POST["file"]))?$_POST["file"]:"") . "",".gif, .jpg, .jpeg, .png",true,1);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"index");
}
}
?>

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

<form action="" method="post" enctype="multipart/form-data" name="upload" id="upload">
<label>
<input type="file" name="file" id="perrge" />
</label>
<label>
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
</form>
<p><?php echo $WA_DFP_UploadStatus["WA_UploadResult1"]["fileExtension"]; ?></p>
</body>
</html>



But the validation doesn't work and everything gets uploaded, the
<?php echo $WA_DFP_UploadStatus["WA_UploadResult1"]["fileExtension"]; ?>

Doesn't work either.

Any ideas?

Thanks in advance.

Sign in to reply to this post

anonymous

Sure... it appears that you placed the validation code after the digital file upload code... so the digital file upload performs the behavior well before you validate. Flip them around to be sure you validate the input first. You may also want to do client side validation for such a form, as well.

Sign in to reply to this post

data387485

Thanks for the reply.

But if I do that, nothing gets uploaded.

The client side can be implemented easily, the main one is the server side.

Sign in to reply to this post

anonymous

When you say "nothing" gets uploaded... do you mean even when the file passes validation?

That definitely would be strange. I have been able to run server validation with no problem. Is there a chance that the code has been changed at all... like maybe a field in your form does not match up with the validation name.

The other thing to do is to check if it the validation code itself causing the problem... to do this I would put the validation code before the Digital File Pro Upload but then create a redirect on fail to see if it something getting stuck in validation.

Sign in to reply to this post

Jason ByrnesWebAssist

When you apply the File Extension server Validation, Click the Lightning bolt next to Server Variable to access the Dynamic Data bindings panel. In the Bindings panel, expand the form collection. You will notice a few variables at the bottom of the form collection that have the Lightning Bolt Icon, select the "file Simple File Name variable.

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