PDA

View Full Version : Max upload size


twebb290214
06-21-2009, 01:25 PM
hi, i'm thinking of upgrading to DFP2

does it rely on the pnp.ini for the max upload size?
my provider sets this at 8mb which is not enough for me as i'm uploading seromons on mp3 up to 20mb
can DFP2 do this?

Thanks
Tom

Travis250923
06-22-2009, 05:09 AM
DFP is only limited to what is in the php.ini file. If that is too low I believe there might be a work around using htaccess.

http://roshanbh.com.np/2008/01/uploading-larger-files-in-php.html

Never tried it but others here may have more info.

Ray Borduin
06-22-2009, 07:01 AM
DFP cannot override the server settings set by your ISP when it comes to uploads.

Cologne
06-24-2009, 01:36 PM
Where can I in put the maximum size of the image that can be uploaded?

This was nice in DFP1

Cheers
Denis

Ray Borduin
06-24-2009, 03:28 PM
Now you would use WA Validation toolkit server validation to validate the size as an integer.

Cologne
06-24-2009, 09:39 PM
ok, which validation type is that? interger? i cant find that.
Denis

Ray Borduin
06-25-2009, 08:07 AM
Integer validation. Then use the binding for the file size of the upload. I believe it is returned in bytes.

Cologne
06-25-2009, 12:27 PM
I cant find INTEGER, is it NUMBER? If its number it doesnt work :-(

trigger is button

validation type is number

server variable is $_FILES["fileField"]

please a documentation, same for SIZE (width & height) :-)

Ray Borduin
06-26-2009, 05:37 AM
Should be number validation. You would apply it twice... once for width and once for height. Width and height should be available separately in the form binding.

Cologne
06-26-2009, 07:43 AM
PLEASE!

show me how to do it.

WHAT is the TRIGGER?

Why was this delete in the DFP2??????

I need check filesize, width height.

What trigger? Button or something else? cause i think i only can be checkt if its uploaded.

why was it deleted from DFP2? this ist really a step back.


PLEASE, I need documentation how to do that with DFP2 and VTK.

File Size, Width, Height.

The BUTTON trigger couldnt be, cause it setzt the validation before the upload.

I need trigger, IF UPLOAD is ok, THEN check the 3 things.

Please make an update for VTK, that would be cool.


this makes no sence. alwys double work!


I need HELP,

thanks
Denis

Ray Borduin
06-29-2009, 08:24 AM
I will recommend to the documentation team that we create a step by step tutorial. Have you read the documentation that comes with DFP? It should cover how to get the width and height of an image, and validation toolkit should allow you to validate those values as numbers.

Are you still having trouble identifying how to refer to the width and height? Forget validating them for a second. Can you display the width and height of an uploaded image or store it into your database? Just trying to identify if you are having trouble using validation toolkit, or referencing the width and height numbers.

Cologne
06-30-2009, 12:49 PM
Hi Ray,

let me just tell what I want.

I create a form with lots of fields, selectboxes etc. and an upload-file field.

So, the user is allowed to upload only images with max filesize and max width and height.

sofar so good.

all my validation is done with VTK and the captcha is from ContactForm.

now, I want error messages, IF the max filesize, max width & hieght fails.

in my opinion, i have to have 2 validations.

one for the form text and one after the upload, to check.

thats where I stuck...

Ray Borduin
06-30-2009, 12:59 PM
If you use the file size, width, and height from the form bindings and not from the uploaded field bindings those values will actually be available before the upload takes place so that they can be validated.

Cologne
06-30-2009, 01:31 PM
I cant find it?


<?php
if (!function_exists("WADFP_getImageHeight")){
function WADFP_getImageHeight($fileField){
$WA_ImageContentTypes = array("image/gif" => true , "image/jpeg" => true, "image/pjpeg" => true, "image/x-png" => true, "image/png" => true);
$height = -1;

if(isset($fileField) && isset($fileField["tmp_name"]) && isset($fileField["type"]) && isset($WA_ImageContentTypes[$fileField["type"]]) ){
$dimensions = getimagesize($fileField["tmp_name"]);
$height = $dimensions[1];
}
return $height;
}
}
?>
<?php
if (!function_exists("WADFP_getImageWidth")){
function WADFP_getImageWidth($fileField){
$WA_ImageContentTypes = array("image/gif" => true , "image/jpeg" => true, "image/pjpeg" => true, "image/x-png" => true, "image/png" => true);
$width = -1;

if(isset($fileField) && isset($fileField["tmp_name"]) && isset($fileField["type"]) && isset($WA_ImageContentTypes[$fileField["type"]]) ){
$dimensions = getimagesize($fileField["tmp_name"]);
$width = $dimensions[0];
}
return $width;
}
}
?>
<?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
if (isset($_POST["button"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_upload_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["VenueName"]))?$_POST["VenueName"]:"") . "",true,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["VenueStreet"]))?$_POST["VenueStreet"]:"") . "",true,2);
$WAFV_Errors .= WAValidateAN(((isset($_POST["VenuePostcode"]))?$_POST["VenuePostcode"]:"") . "",false,false,true,false,"",true,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["VenueCity"]))?$_POST["VenueCity"]:"") . "",true,4);
$WAFV_Errors .= WAValidateNM(((isset($_FILES["VenueImage"]))?$_FILES["VenueImage"]["size"]:"") . "",0,150,0,",.",true,5);
$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["VenueImage"]))?$_FILES["VenueImage"]:"") . "",0,1000,0,",.",true,6);
$WAFV_Errors .= WAValidateNM(WADFP_getImageHeight((isset($_FILES["VenueImage"]))?$_FILES["VenueImage"]:"") . "",0,1000,0,",.",true,7);

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' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "300",
'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", "VenueImage", "0", "", "JPG:100", $WA_UploadResult1_Params);
}
?><!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=iso-8859-1" />
<title>Unbenanntes Dokument</title>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="FormUpload" id="FormUpload">
<p>Name:
<input type="text" name="VenueName" id="VenueName" />
</p>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?><p>

Enter Venue Name
</p><?php //WAFV_Conditional upload.php upload(1:)
}
}
}?>

<p>Strasse:
<input type="text" name="VenueStreet" id="VenueStreet" />
</p><?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<p>Enter Street
</p>
<?php //WAFV_Conditional upload.php upload(2:)
}
}
}?>

<p>Postleitzahl:
<input type="text" name="VenuePostcode" id="VenuePostcode" />
</p>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "3" . ",") !== false || "3" == "")) {
if (!(false)) {
?><p>

Enter Postcode
</p><?php //WAFV_Conditional upload.php upload(3:)
}
}
}?>
<p>Ort:
<input type="text" name="VenueCity" id="VenueCity" />
</p>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "4" . ",") !== false || "4" == "")) {
if (!(false)) {
?><p>

Enter City
</p><?php //WAFV_Conditional upload.php upload(4:)
}
}
}?>
<p>Bild:
<input type="file" name="VenueImage" id="VenueImage" />
</p>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "5" . ",") !== false || "5" == "")) {
if (!(false)) {
?><p>

Wrong Filesize
</p><?php //WAFV_Conditional upload.php upload(5:)
}
}
}?>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "6" . ",") !== false || "6" == "") || (strpos((",".ValidatedField("upload","upload").","), "," . "7" . ",") !== false || "7" == "")) {
if (!(false)) {
?><p>

Wrong Width or Height
</p><?php //WAFV_Conditional upload.php upload(6,7:)
}
}
}?>
<p>Only Images</p>
<p>
<input type="submit" name="button" id="button" value="Senden" /></p>
</form>
</body>
</html>

Ray Borduin
06-30-2009, 01:34 PM
In the bindings window, not in the code.

Go to Window->Bindings

or in Validation toolkit click on the lighning bolt. That is where you should be looking for the way to reference the file size, width, and height of the uploaded image. It should be there even if you have no code on your page... it has nothing to do with the upload really.

Cologne
06-30-2009, 01:48 PM
ok, I think i got it, and then?
Am I the only one to ask that question :-)

I want to have SERVER VALIDATION :-)))

How long will this tutorial with images take?

Denis

Ray Borduin
06-30-2009, 02:02 PM
Not that one... should be another one under FormUpload in the same window.

Cologne
06-30-2009, 02:09 PM
ok, that one?

so, this is what I used when i use the VTK.

Button pressed, then under the FORM ---> fileSize ---> check with number (english, 0,100, no decimals)

and, its not working :-(


$WAFV_Errors .= WAValidateNM(((isset($_FILES["VenueImage"]))?$_FILES["VenueImage"]["size"]:"") . "",0,150,0,",.",true,5);

Ray Borduin
06-30-2009, 02:39 PM
Looks good to me. What happens when you try. What do you mean by "not working" always valid? always invalid? error?

Cologne
06-30-2009, 03:16 PM
It does not work. I think it cant be NUMBER.

Is button pressed the trigger?

here is my page:

trigger is button pressed
file size not bigger than 150
width and height not bigger than 1000


<?php
if (!function_exists("WADFP_getImageHeight")){
function WADFP_getImageHeight($fileField){
$WA_ImageContentTypes = array("image/gif" => true , "image/jpeg" => true, "image/pjpeg" => true, "image/x-png" => true, "image/png" => true);
$height = -1;

if(isset($fileField) && isset($fileField["tmp_name"]) && isset($fileField["type"]) && isset($WA_ImageContentTypes[$fileField["type"]]) ){
$dimensions = getimagesize($fileField["tmp_name"]);
$height = $dimensions[1];
}
return $height;
}
}
?>
<?php
if (!function_exists("WADFP_getImageWidth")){
function WADFP_getImageWidth($fileField){
$WA_ImageContentTypes = array("image/gif" => true , "image/jpeg" => true, "image/pjpeg" => true, "image/x-png" => true, "image/png" => true);
$width = -1;

if(isset($fileField) && isset($fileField["tmp_name"]) && isset($fileField["type"]) && isset($WA_ImageContentTypes[$fileField["type"]]) ){
$dimensions = getimagesize($fileField["tmp_name"]);
$width = $dimensions[0];
}
return $width;
}
}
?>
<?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
if (isset($_POST["button"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_upload_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM(((isset($_FILES["Image"]))?$_FILES["Image"]["size"]:"") . "",0,150,""," ,",true,1);
$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["Image"]))?$_FILES["Image"]:"") . "",0,1000,"",",.",true,2);
$WAFV_Errors .= WAValidateNM(WADFP_getImageHeight((isset($_FILES["Image"]))?$_FILES["Image"]:"") . "",0,1000,"",",.",true,3);

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' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "300",
'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", "", "JPG:100", $WA_UploadResult1_Params);
}
?><!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=iso-8859-1" />
<title>Unbenanntes Dokument</title>
</head>

<body>
<form action="" method="post" enctype="multipart/form-data" name="FormUpload" id="FormUpload">
<p>Bild:
<input type="file" name="Image" id="Image" />
</p>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?><p>

FileSize wrong
</p><?php //WAFV_Conditional upload.php upload(1:)
}
}
}?>
<?php
if (ValidatedField('upload','upload')) {
if ((strpos((",".ValidatedField("upload","upload").","), "," . "2" . ",") !== false || "2" == "") || (strpos((",".ValidatedField("upload","upload").","), "," . "3" . ",") !== false || "3" == "")) {
if (!(false)) {
?><p>

Width / Height wrong
</p><?php //WAFV_Conditional upload.php upload(2,3:)
}
}
}?>
<p>
<input type="submit" name="button" id="button" value="Senden" />
</p>
</form>
</body>
</html>



It must be something with the FILE SIZE. I set it to 150 for 150KB, doesnt work. if i set to 5000 it works.
what number is how much? I tihnk the problem is the 1,000 1.000 and 1000


IT MUST BE international !!! thats the trick i think.


Width and height works.

hmmmmm

Ray Borduin
07-01-2009, 07:13 AM
Try settting it to 150000 for 150kb

Cologne
09-06-2009, 01:45 AM
I did, what do I have to set to limit 2 MB?

2000000?

Ray Borduin
09-08-2009, 03:02 PM
Yes. But this won't supercede any limitation set in the php.ini. You need to make sure your php server has enabled uploads of that size as well.

Cologne
09-08-2009, 10:10 PM
My limit is 10MB!

2000000 :-) Will this thing be put back into DFP2? I really cant imagine why all this things are deleted from DFP2.

man man, I cant change my ini.

Please make those things back in the DFP. you take some out and put some other in.

Now I need 2 extensions to handle an upload, this is, what s*cks!

Denis

Ray Borduin
09-09-2009, 09:00 AM
We will actually be working on integrating both into DataAssist and Form Builder so that you can have a single product workflow.

Cologne
09-09-2009, 10:05 AM
Ray,

its not what I want.

In DFP1 everything was included. SIZE, WIDTH, HEIGHT, exept the making of thumbnails.
Now, we got DFP2 and it can thumbails, but lost SIZE; WIDTH, HEIGHT.

So, to fix that, I need to have VTK, and that means, I need two extensions just to upload, an image.

I dont understand what, FormBuilder and DataAssist got to do with that fact :-)

with DFP 1 & 2 you got to half THINGS, put em together and release DFP3 it will be, a real big thing! belive me!

Denis

Ray Borduin
09-15-2009, 04:29 PM
We will actually be working on integrating both into DataAssist and Form Builder so that you can have a single product workflow.

neilo
09-17-2009, 06:49 PM
Hiya Ray,

Just to be clear, - you will be incorporating Validation Toolkit and Digital File Pro into Data Assist (and Form Builder)?

That would be excellent. When can we expect to see this?

Ray Borduin
09-18-2009, 07:09 AM
That is correct. We are still in early planning stages, so it will be several months before we have a working version we can start testing. Due to the complexity it could take a while to properly QA as well, so it will take some time.

neilo
09-18-2009, 09:34 AM
Many thanks Ray,

I will definitely be purchasing that one. Looking forward to it!

pau376010
09-20-2009, 02:17 AM
I have the same problem. I have carefully read all correspondence with Cologne and I continue to have same difficulties. I can not limit the size of a file whatever server validation I apply.
I could get back to DFP1 but I need to apply image resize on other areas of my web.

Could you try to specify the validation instructions, please?

Ray Borduin
09-21-2009, 11:36 AM
You should be able to use integer validation on the size, which should appear as part of the form bindings just like any other form field.

Are you able to apply server validation in general on any form fields? There should be no difference since size should now appear in the bindings as if it were a field in the form.

pau376010
09-24-2009, 10:44 AM
It seems to be alright now. Apparently, the kye lies on the order in which I applied different Universal Email and DFP2 Behaviours. The result is quite fine and every thing is working now, except that:

The files sent as an email attachment remain in the upload folder without linking to any Data Base, so that I can not delete the files using DFP. Which should be the most elegant way to completely empty the upload folder within 1 - 2 clicks ??. I might apply a web ftp to do it, but is is not a nice solution !

Thanks a lot