aspose file tools*
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 Spring in Action this week in the Spring 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: 301
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: 9305
    
  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: 301
I rename the file.
from a.exe to a.doc.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  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