Hi All,
I am working on a scenario, where i need to set the file limit to 5MB to upload list of files at one time.
for this I am using javascript to get filesize and performing validation, but it is working for only first row and for the rest of the rows it is failing. I think the javaScript i am using here has an issue, can anyone please tell me the error in javascript I am using.
I am attaching sample Poc for this issue.
URL: Demo Screen
can someone help me here.
Thank You,
Rahul.
Hi Rahul,You can check these discussion related file upload . May it will help you to get the proper solution.
Hi,
Thank You, it worked..
Sorry Rahul,
i read a bit too quick through your post, your start isn't right, it should be querySelectorAll instead of querySelector. And the files[0] was correct, sorry for saying it wasn't.
See attached your oml with modifications. What i changed :
Dorine
Hi Rahul,
Your start is good, querySelector produces a list of elements.
But you don't have any logic for looping through the list, you are only looking at the first one : [0].
Also, what exactly is your requirement, that no single file goes over 5MB, or the total size of all files together.
So loop the elements, in first case set filesize to the largest one you find, in second case set it to the sum.
Either way, I would probably have a boolean as result, and have a max size as input variable.
Thank You for the response,
I am looking for the first case you mentioned, can you please brief your solution.
Sry, I did not get exact solution u mentioned.
Thank you.
Thank You, Dorine.