This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes how to check the exe file validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to check the exe file validation" Watch "how to check the exe file validation" New topic
Author

how to check the exe file validation

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
Hi,
I am using strut2. And uploading the file.

I used the java script to avoid the exe file uploading.

But when i rename it.It get uploaded.

Can any tell me how to avoid exe file validation.

Thanks
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

pankaj semwal wrote:But when i rename it.It get uploaded.


What do you mean?? Did you rename A.exe to B.exe or did you change the extension of the file??


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
I rename the file.
from a.exe to a.doc.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Well since you changed the file name, javascript will definitely pass the file as being ok. If you want to check if a file is actually an exe file with a different extension, then you'll have to do something on the server side. You might need to check the first few bytes of the file (called the header) but I don't have any idea about exe file headers...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to check the exe file validation