java – VRaptor – Uploading files on IE 8/9 does not work

Question:

I'm trying to upload files and it's not working in IE 8.

NOTE: Works on Chrome and Firefox perfectly.

I've been researching and saw that IE 8/9 doesn't support FormData as enctype . Ex:

<form id="form" method="post" enctype="multipart/form-data" action="/xpto/upload">

However, according to vRaptor documentation this enctype is necessary for me to receive my UploadFile instantiated in Controller. Ex.:

@Post("/xpto/upload") 
public void upload(UploadedFile arquivos[])

And, in fact, I've tested it in Chrome and when I don't put enctype="multipart/form-data" my files ( UploadFile arquivos[] ) come with null , when I put it works correctly.

Given this situation I would like to know if there is any way I can make my upload work in vRaptor in IE 8 without needing to use enctype="multipart/form-data" .

I thank the attention.

Answer:

It may not be working in IE 8/9 because the page is loading in compatibility mode.

Anyway, try to also put the encoding attribute, with the same value as enctype :

<form id="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" action="/xpto/upload">

It's okay to have both, it works fine in all browsers.

Scroll to Top
AllEscort