I have a form where i allow the user to upload files as much files as they want until they reach X mb.
Suppose that X = 1 mb, they can upload 1 file of 1 mb OR 2 files of 500 ko OR 5 files of 200 ko.
How did i try to do that :
In the event "onChange" of the "input file", i load a servlet which redirect the user to another jsp (popup).
CheckFile.java - GET
And then in the Servlet post method, i could check the size of the file, redirect to the jsp and, using js, tell the parent window that the user can still upload (1MB - filesize) Ko.
The problem is : You CAN'T change input file value...
I know that it's way much easyer and cleaner to use ajax, but i can't use it neither..
Can anyone know how i could do that without reloading the main jsp page?
Thanks. (and sorry if my english is not that good :$)
check out the below link
Any approach using ActiveX would be limited to a single browser on a single operating systems, and introduce all the security problems of ActiveX - not exactly what web apps are all about.
Jigar Naik wrote:You can use java script to check the file size using ActiveX objects.
check out the below link
I can't use ActiveX Objects, they re blocked here, "security"..
Lester Burnham wrote:
you can't know the file size unless you upload the file.
That's why i tryed such a system.
I opened a popup and uploaded the file in this children window.. Then i could know the file size trought the children window servlet and tell it to the parent (main) window using "window.opener"
But i can't set the value of the input file popup window because this input is readonly.. That's the only thing blocking me..
Any other idea?
Thanks for your interest
But i can't set the value of the input file popup window because this input is readonly.
I'm not sure what you're trying to accomplish, though. Do you want to display the combined size of all files that were uploaded so far? That would be better done in a DIV or SPAN, not the FILE field.
So i can let the user select one more file to upload if the actual combined size is lower than the size limit.
The user is allowed to upload 1Mb. A label tell him 1 Mb max remaining.
1 input file is visible ... the user select a file of 200 kb -> 800 kb remaining
1 more input become visible .. the user select a file of 500 kb -> 300 kb remaining.
1 more input become visible ..
I hope you understand
Some rules can't be broken ^^
David Newton wrote:
Well yeah--how else would you make something dynamic other than by programming it?!
Well yeah.. I mean i'm stuck with old technologies... no ajax, no jquery,no activeX objects..
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
ScroogeXHTML 7.2 - RTF to HTML5 / XHTML converterhttps://coderanch.com/t/692027/ScroogeXHTML-RTF-HTML-XHTML-converter