Ranch Hand
posted 6 years agoAnother important thing is to not include the tag inside, because is the BeginForm that opens the tag – pocjoc Jun 4 '14 at 14:22. In other words - Your view model property name must match that of the input type name.
Guys I created a JSP to upload excel files to a server. But It still seems to be letting any type of file to be uploaded. Is there a way to do it? following is my JSP.
Regards,
Sapumal.
Regards,
Sapumal.
Be you.. not someone else.. in everything you do..
Rancher
posted 6 years agoA quick googling suggest that this attribute is not consistently and reliably implemented by browsers (and not all by some widely used versions, like Safari 5 and IE 9).
But regardless of that, you should not rely on the client anyway, and need to implement the check on the server (where it's easy to implement a much more reliable test).
But regardless of that, you should not rely on the client anyway, and need to implement the check on the server (where it's easy to implement a much more reliable test).
Saloon Keeper
posted 6 years agoYou cannot block uploads on the server side based on file type. Neither the file extension nor the upload MIME type can be trusted. Which is one of the ways malware gets in.
The best you can do is to discard the uploaded data if you disapprove of it.
One reason you can't block the upload is that (barring 'chunked' transmissions), the data is actually part of the total form upload data packet, not something transferred independently the way that images are. So by the time you know what's arriving, it's already there.
The best you can do is to discard the uploaded data if you disapprove of it.
One reason you can't block the upload is that (barring 'chunked' transmissions), the data is actually part of the total form upload data packet, not something transferred independently the way that images are. So by the time you know what's arriving, it's already there.
Being persecuted doesn't in any way prove your righteousness or your beliefs. Many people get persecuted because they are repugnant or annoying. Or just because they can be.
Ranch Hand
posted 6 years agoThanks for the advice guys.. So should it be done in my servlet or somewhere else? I mean using a java script or something like that?
Regards,
Sapumal.
Regards,
Sapumal.
Be you.. not someone else.. in everything you do..
Marshal
posted 6 years ago[Asking smart questions] [About Bear] [Books by Bear]