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

File Extension Checked By VTK2

Thread began 9/27/2009 2:15 pm by Cologne | Last modified 3/03/2010 6:44 pm by Eric Mittman | 3077 views | 6 replies |

Cologne

File Extension Checked By VTK2

hi,

i try to check the file extension with VTK2 but it does not work. file-size works. hmmm...

<?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 require_once("WA_SecurityAssist/WA_RandomPassword.php"); ?>
<?php
if (!session_id()) session_start();
if(isset($_POST["button"])) {
$_SESSION["imageName"] = "".WA_RandomPassword(15, true, true, true, "") ."";
}
?>
<?php
if (isset($_POST["button"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_upload_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateFE(((isset($_FILES["image"]))? preg_replace('/^.*\./', '', $_FILES["image"]["name"]) :"") . "",".gif, .jpg, .jpeg, .png",true,1);
$WAFV_Errors .= WAValidateNM(((isset($_FILES["image"]))?$_FILES["image"]["size"]:"") . "",0,250000,0," ,",true,2);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"upload");
}
}
?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "upload/",
'FileName' => "".$_SESSION['imageName'] ."",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "400",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["button"])){
WA_DFP_UploadFiles("WA_UploadResult1", "image", "0", "", "false", $WA_UploadResult1_Params);
}
?>
<?php
if($WA_DFP_UploadStatus["WA_UploadResult1"]["statusCode"] == 1){
$WA_Redirect_URL = "upload_finished.php";
$WA_Redirect_KeepQS = false;
if ($WA_Redirect_URL != "") {
if ($WA_Redirect_KeepQS && $WA_Redirect_URL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "") {
$WA_Redirect_URL .= ((strpos($WA_Redirect_URL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_Redirect_URL);
}
}
?>
<!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>upload</title>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="formUpload" id="formUpload">
<label>Bild:
<input type="file" name="image" id="image" />
</label>

<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<p>Das ist kein Bild</p>
<?php //WAFV_Conditional upload.php upload(1:)
}
}
}?>

<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<p>Das Bild ist zu groß</p>
<?php //WAFV_Conditional upload.php upload(2:)
}
}
}?>
<p>
<label>
<input type="submit" name="button" id="button" value="Hochladen" />
</label>
</p>
</form>
</body>
</html>



thanks for help,
denis

Sign in to reply to this post

Eric Mittman

When you applied the validation how did you configure it and what is the extension you are checking for? Also, what is the trigger for your validation? I can look into this further for you to see if there is a problem with the tool or if it might be just a configuration issue.

Sign in to reply to this post

Cologne

?

The trigger is the click of the SEND Button. I check ther FormVariable that is shown in the Behaviors panlel under the Upload.
I check if its JPG, PNG, GIF etc. like it is in the code above.

the file-size is checked but not the extension.

what else then the sourcecode should i post?

Denis

Sign in to reply to this post

Eric Mittman

Thanks for the extra info, this was enough for me to get started. I have done some limited testing and have found it not working as I would expect. I have opened a ticket for you on this in case we need to exchange files. To update your ticket please login to WebAssist.com and visit your support history. I will be updating the ticket shortly when I have some more info for you.

Sign in to reply to this post

Eric Mittman

I have found out some more info about this and have updated your ticket with something to try that should get it working for you. Please login and update the ticket so that I can confirm the results, once confirmed I will update this thread with what was discovered.

Sign in to reply to this post

Andrew Read

Was there ever a solution to this problem???

Sign in to reply to this post

Eric Mittman

The wrong binding was being used for the file name, originally the value used for the file name was:

((isset($_FILES["image"]))? preg_replace('/^.*\./', '', $_FILES["image"]["name"]) :"") //file extension binding

Instead it should be this:

$_FILES["imageName"]["name"] //this is the file field binding

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