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

Validate Max File Size for DFP Upload

Thread began 10/08/2009 7:37 pm by Dave Buchholz | Last modified 2/28/2010 12:28 am by Miguel | 4777 views | 16 replies |

Dave BuchholzBeta Tester

Validate Max File Size for DFP Upload

With a nod to this thread in the DFP forum I have a situation where I need to limit the image upload size to for the sake of argument 500kb and the most obvious way to do this is to validate it server side BUT if you have the validation routines BEFORE the upload routines the WA_UploadResult1 array has not yet been created so $WA_DFP_UploadStatus["WA_UploadResult1"]["fileSize"] is undefined and no validation takes place, having the validation routine after the upload routine means that the file has already been uploaded which defeats the object of validating it in the first place.

In DFP1 you could set maximum file sizes that made this much easier.

Is their an answer to this issue ?

Sign in to reply to this post

Cologne

I use VTK2

If you create a form with a file field. use the server validation. use to check the FILE-SIZE you can find it under the file-field.

check it against NUMBER, use intrenational and zero decimals. for 500KB you need to set max to 500000.

here is the my VTK2 line

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



I hope that helps.

I already wished to have that limit of file-size and image size back in the DFP2 like it was in DFP1, in this case its a step back.

Denis

Sign in to reply to this post

Cologne

screenshots

Sign in to reply to this post

Dave BuchholzBeta Tester

Ahhh thanks Denis I see where I was going wrong

Sign in to reply to this post

Miguel

im trying to do that but with the picture width and height, but if i follow those steps when i try to submit the form im getting:

Fatal error: Call to undefined function WADFP_getImageWidth() in C:\xampp\htdocs\xxxxxxxx\admxxxxx\cat_Insert.php on line 18

and on line 18 i have

$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["foto"]))?$_FILES["foto"]:"") . "",1,500,0," ,",true,5);

do i need to do something else in order to avoid ppl uploading pictures over a size that i want?

Or is there any recepie on how to validate file size, width, height etc... cant find any specially about height and width

Sign in to reply to this post

Jason ByrnesWebAssist

sounds like the require once line for the WA_DigitalFile Pro/Helper_PHP.php file is on the page after the validation toolkit code, move that file to around line 1 so the function will be declared before it is used.

Sign in to reply to this post

Miguel

ok i just did that now when i press insert it just reloads the form doesnt insert just reloads the form and shows some of the required fields if empty

Sign in to reply to this post

Miguel

ok i missed some things i did that to several of my insert page but checked one that was not the one that had to check for width and height the one that has to check the width and height of a picture keeps giving me the exact error moving the required <?php require_once("../WA_DigitalFilePro/HelperPHP.php"); ?> to line 2 just after the conection requirement.

Also on the insert page where i want to do a check file extension if i add this it just doesnt insert anything just reloads the page if i take out the check extension the validations work but this one has nothing about the width or height wich is 2 difrent page issues.

i added both files so techs here can have a better look seems like a bug unless im doing something wrong

Attached Files
files.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the file extesnion validation is failing.


the preg_replace function is triming the period from the file externsion. change the code:

php:
$WAFV_Errors .= WAValidateFE(((isset($_FILES["foto"]))? preg_replace('/^.*\./', '', $_FILES["foto"]["name"]) :"") . "",".gif, .jpg, .jpeg, .png",true,4);




to:

php:
$WAFV_Errors .= WAValidateFE(((isset($_FILES["foto"]))? preg_replace('/^.*\./', '', $_FILES["foto"]["name"]) :"") . "","gif, jpg, jpeg, png",true,4);
Sign in to reply to this post

Miguel

Thank you Jason will try that right now and what about the error msg if i try to validate size?

Fatal error: Call to undefined function WADFP_getImageWidth() in C:\xampp\htdocs\xxxxxxxx\admxxxxx\cat_Insert.php on line 18

i did move what you said to the first line, second line with no luck

Sign in to reply to this post
loading

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