This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi everybody, I am Chaitanya, I want to upload files to server in my application and I want to restrict the file size say 1MB for an image, what I am thinking to do is run an actionscript function to check the file size at server side as soon as the user clicks submit button, I will force the client to install flash player plugin and enable java script.
Is the approach right? Thank you all in advance. Have a good day.
I think you people may say forcing the user to install a plugin for a silly upload is not the right way.
I say forcing the user is the right approach because instead of just uploading it to the server and checking the file size and breaking the request and asking him to upload the specified size file is somewhat time consuming. I think prevention is better than cure here.
Paul Sturrock wrote:How else do you use Action Script without the user installing a version of Flash Player?
Moreover I wont suggest programmers to follow this method, I give up. Because if the client uses Google chrome browser the file path cannot be taken into java script, chrome will only return the file name, not the entire path, where as Mozilla and IE will return the entire path. So in chrome we cannot find the file size.
Hi Paul, you, misunderstood me. Actually the aim was to find the file size at the client side instead on finding the size at server and dropping the request if the size exceeds.
So I dropped the idea. Hope now you understand what I was trying to do.