You are viewing limited content. For full access, please sign in.

Question

Question

Limit the number of File Uploads in a Form

asked on September 9, 2014

We would like to limit the number of files that someone would be able to upload on a Form.  We know you can limit the size of the file, but we are more interested in limiting them to just attach 1 file and not multiple.  Is this currently possible with Forms 9.1.1.1522?

 

Thanks

 

0 0

Replies

replied on June 16, 2016

Limiting uploads is available in Forms 10.1.

2 0
replied on June 16, 2016

Outstanding.  Then an upgrade I will be doing. Time to clear my afternoon.  Thank you for the quick reply.

0 0
replied on June 30, 2016

NP

1 0
replied on September 9, 2014

Hi Derick,

 

This is not currently a feature available in Forms. To limit the number of files a given file upload field will accept, JavaScript can be used. 

0 0
replied on September 9, 2014

Would someone from Development or Presales be able to possibly provide me with a Javascrip example of how to limit that number of uploads?  If not no problem, maybe someone else in the Laserfiche Community has tried this before.

 

Thanks

0 0
replied on September 9, 2014 Show version history
$(function() {
  $(document).ready(function () {
    $('.limit input').removeAttr('multiple');
  });
});

Set the fileUpload field to have the CSS Class "limit" and this would work.

 

EDIT: this would only make it able to select one file at a time, not limit the total amount. I am looking into how to accomplish what you are asking though

0 2
replied on September 9, 2014

It does not appear to be a default option, but would require some heavy lifting to be done through Javascript. At this time, I feel it would be best to see if a Laserfiche Employee is able to answer this request/question. 

0 0
replied on September 9, 2014 Show version history

Can you do it? Yes. Should you do it? Well, there's a performance hit with this JavaScript because it repeats itself, so it's up to you to determine if that's going to work for you.

$(document).ready(function () {
    $('.fileuploader').removeAttr('multiple');
    setInterval(fileUploadPolling, 500);

    function fileUploadPolling() {

        if ($('.files tbody tr').length > 2) {
            $('.fileuploader').attr('disabled', true);
        } else {
            $('.fileuploader').removeAttr('disabled');
        }
    }
});

This is something we'd like to improve in the future.

 

Update: Ege reminded me that you can still drag and drop multiple files in. This code does not account for dragged in files.

0 0
replied on September 10, 2014

I will get with one of our developers and try and plug this into our Form and then see how it reacts with performance.  This is an internal Form that does not get used everyday, but it does get quite a bit of use.  However, it would be extremely helpful if we could limit to only allow 1 file to be uploaded.  I will reply again after implementing this.

 

Thanks

0 0
replied on September 10, 2014

My solution only disabled the ability to select multiple files at 1 time, but that does not limit the amount of files in total to allow. 

0 0
replied on September 10, 2014

I understood that Kenneth, I was going to look into applying the code that Eric provided to see what that would do.  I complete understood what you were saying about it disabling you being able to select multiple file at 1 time.

0 0
replied on September 10, 2014

Oh, I did not even see that he replied. I will have to give that code a try myself as well

0 0
replied on September 10, 2014

Thanks for the update Eric, that is good to know for sure.  I have not tried this out yet, but I will let the person requesting this know all of the facts before we move forward with this.

 

Thanks

0 0
replied on September 10, 2014

Eric,

 

Can you not just disable the drag and drop functionality? Just not allowing that type of input would resolve that issue.

0 0
replied on April 14, 2015

Hello, I am interested in limiting file uploads to only one and not multiple.   Has there been any update/changes to what was described above?   (using java script = performance hit)

 

Or is this the current process for Forms 9.2.1.1069?

0 0
replied on October 21, 2015

Also looking at possibly doing this myself as well. Trying to look up Javascript code for it. I believe Laserfiche uses the Ajax uploader and there are a couple of options to limit the number of files, but so far I havent been able to implement those. There's 1 setting to control max files/drag&drop and upload selection, and 1 setting for total number of documents in the upload form. Id be looking to limit to 1 if possible so that I can assign specific field data to 1 document at a time. I can see this being an important feature though, ie on job submissions where you could limit it to 2 documents (cover letter and resume).

Ill let everyone here know what code I find that does work if I find out. Otherwise, if anyone has any code related to it, can they post it?? Thanks!

0 0
replied on June 16, 2016

Any results regarding your search?  I've been needing a solution to this for quite some time. 

 

It seems this would be a hugely beneficial feature to add natively.  One of my forms utilizes an upload insde of a collection which may make the Java a bit more difficult.

0 0
replied on March 29, 2016

I am just checking to see if this feature has been made available yet? How bad is the performance hit if Javascript is used?

0 0
replied on October 4, 2017

Hello all,

I know this is an old post but I'm actually looking for the same thing. Limit to 1 upload. We are in 10.2.1 Forms and I still didn't see an out-of-the-box setting for this.

How did you all tackle this?

Thank you,

Raul Gonzalez

0 0
replied on October 4, 2017

 

The file upload Limit option is under the upload fields.  Once on, it will display like a validation error does.  See below. 

 

 10.2.1.157

1 0
replied on October 4, 2017

Ah. Right in front of me.

Thanks Andres; I see it now.

1 0
replied on October 4, 2017

Any time.  

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.