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

Question

Question

Total size of file upload(s)

asked on June 29, 2020

I am looking for a way to determine the total size of the file(s) uploaded with a form.    I have a single upload button where users can upload up to 5 files.   I am not sure how to iterate over the upload with JS and add up the values.

Any help appreciated.

Andrew

0 0

Replies

replied on July 3, 2020

You want to display the total file size to end user or limit them to upload new files when they reach the allowed total size limit?

0 0
replied on July 7, 2020 Show version history

The files being uploaded are being emailed to the submitter in response to their request for public records.    I would like to be able to determine the total size of the file(s) that are to be sent.   Our email server will only accept X amount to be sent.    I would like the process diagram to be able to decide if the reply should be emailed or it needs a different option.

I was looking at something like:

  var totalSize = 0;

  $("#q5 input").on('change', function() { 
  	$("#q5 input").each(function() {
    
    	for (var i = 0; i < this.files.length; i++) {
      		totalSize += this.files[i].size; 
    	}
      alert("Total Size: " + totalSize);
	});
  });

Which does add up the total file size but does not iterate over each file,  this.file.length is always 1.   And it does not trigger when a file is deleted.

0 0
replied on July 10, 2020

There is no easy way to accomplish this now, you can refer to https://answers.laserfiche.com/questions/163898/File-Upload--Maximum-TOTAL-file-size#163899

1 0
replied on July 13, 2020

Thanks Xiuhong,

I ended up bringing everything into a workflow where I could easily process and group email attachments by size.

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

Sign in to reply to this post.