• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating a fileobject usign javascript

 
Rajani Panchumarthy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to validate a file that needs to be uploaded,<input type="file" />in JSP using javascript.

The following ActiveXObject is used to retrieve the file object:



But, I get script error "Automation server cannot create object". This error is related to security issue in IE. Moreover, this does not work in Mozilla.

Do you have idea of how to get the file object in Javascript other than the above ActiveXObject.

This is mainly for validation of file content , file length at frontend itself.

Thank you.



 
Ayoma Wijethunga
Ranch Hand
Posts: 38
Firefox Browser IntelliJ IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

So you simply want to validate the file input in the client side, itself. Think of it like this. JavaScript is a client side language. So, browser has to access the client's file system, in order to check the size of the file. I don't think any of the browser (except few outdated browsers) will accept this, as it is a major security risk.

So my suggestion is to use a Flash based file uploader. Swfupload support this kind of validations in client side itself. Don't know if it is possible with JavaFX. If possible you can give it a try.

Regards.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Ayoma stated, you need to look at a different technology or do it all on the server.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic