TOPIC:

Re: Attachment File Size Restriction 7 years 11 months ago #88955

  • Defiler's Avatar
  • Defiler
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
Here it is. There is a section to upload two images. I'd like them limited to 2MB.

Let's try that again with a zip file.
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by Defiler.

Re: Attachment File Size Restriction 7 years 10 months ago #89172

  • Syno
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 2186
  • Karma: 3
  • Thanks: 209
Hello,

sorry for the delay.

I just checked your form and the problem is that you need to provide the size in byte and not kilobyte.

So please try the scripts in your upload validations like this:

function ff_bfQuickMode66563_validation(element, message)
{
elem=element.files[0];
if(element.value==''){
if (message=='') message = " please provide Upload"
ff_validationFocus(element.name);
return message;
}else{
if (elem.size>2097152) { // change 8000 to the value you need
if (message=='') message = elem.size+" faild in my test.\n"
ff_validationFocus(element.name);
return message;
} // if
}
return '';
} // ff_bfQuickMode66563_validation


I hope this helps.

Regards,
Syno

Please Log in or Create an account to join the conversation.

Re: Attachment File Size Restriction 7 years 10 months ago #89342

  • Defiler's Avatar
  • Defiler
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 30
  • Thanks: 0
That did the trick! Thank you.

Please Log in or Create an account to join the conversation.

Re: Attachment File Size Restriction 2 months 1 week ago #250475

  • genegun2
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 0
function ff_bfQuickMode2170791_validation(element, message)
{ elem=element.files[0];
if (elem.size>5437505) { // change 5437505 to the value you need
if (message=='') message = "Image 2 is too large. Size must be below 5MB"
ff_validationFocus(element.name);
return message;
} // if
return '';
} // ff_bfQuickMode2170791_validation

While the latter version of this code works (the one with the added compulsory field condition), this one does not. I would like to implement it on my form but my upload is only optional. Can someone help me wok this out?
Thanks!

Please Log in or Create an account to join the conversation.

Last edit: Post by genegun2.

Re: Attachment File Size Restriction 2 months 1 week ago #250483

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2935
  • Karma: 3
  • Thanks: 255
Hi,

this code works for default file upload (if HTML5 and Flash Upload is unchecked).
function ff_NAMEOFYOURUPLOAD_validation(element, message)
{
    elem=element.files[0];
if(element.value==''){
if (message=='') message = " please provide Upload"
ff_validationFocus(element.name);
return message;
}else{
if (elem.size>5437505) { // change 8000 to the value you need
if (message=='') message = elem.size+" faild in my test.\n"
ff_validationFocus(element.name);
return message;
} // if
}
return '';
} // ff_NAMEOFYOURUPLOADFILE_validation

So, I want to be sure. You allowed multi HTML5 upload, and you want to set this "limit" for second uploaded image. Did I understood you correctly?

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

Re: Attachment File Size Restriction 2 months 1 week ago #250510

  • genegun2
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 19
  • Thanks: 0
Yes, the code that you pasted works well. I would just like to remove the if(element.value=='') part of it, so that it can stay a facultative field rather than a compulsory one.

Thanks a lot!

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.051 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!