This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread 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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to check the exe file validation