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