Setting accept when uploading file

Setting accept when uploading file

 
Hi all,
 
I'm trying to upload a form via jquery forms plugin. Here's the form:
 
  1. <form method="post" action="<spring:url value="/grouplist/uploadavatar.do" />" enctype="multipart/form-data" id="formUploadAvatar">
  2. < table width = "100%" >
  3.       < tr >
  4.             < td width = "25%" style =" padding-top : 30px ; margin-top : 30px ; " >
  5.                   < spring:message code = "usersettings.form.usersettings.avatar" />
  6.             </ td >
  7.             < td style =" padding-top : 30px ; margin-top : 30px ; vertical-align : middle ;" >
  8.                   < div id = "divImageAvatar" style =" display : none " >< img id = "avatarImage" width = "32" height = "32" align = "absmiddle" /></ div >
  9.                   < input type = "file" id = "createGroupPopupAvatar" name = "avatar" />
  10.                   < input type = "submit" class = "button" value = " < spring:message code = "general.send" /> " />
  11. <!-- <input type="button" class="button" value="<spring:message code="general.send"/>" onclick="javascript:sendAvatar()" /> -->
  12.             </ td >
  13.       </ tr >
  14. </ table >
  15. </ form >
 
The form contains a file upload field to upload an avatar, and a div with an image where to show the uploaded avatar. Here is the script I use to upload:
 
  1. var uploadAvatarOptions = {
  2.       dataType: 'json' ,
  3.       success: function (data) {
  4.             if (data.code == 0) {

  5.                   // Show image using path contained in the data object
  6.             }
  7.             else {
                      alert (data.description); // Error happened
  8.             }
  9.       }
  10. };
  11. $(document).ready(function() {
  12.       $( '#formUploadAvatar' ).ajaxForm(uploadAvatarOptions);
  13. });
 
This is the response sent from the server:
{"data":"/images/avfile.jpg","description":"","code":0}
 
This works fine in Firefox. However, in IE, the succedd callback contains null in the data parameter. I think this may be because Firefox sends the following headers on submit:
 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
 
The server, controlled by Spring, reacts sending a context type text/html
 
if I try the same in IE8 the headers sent are:

image/gif, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
 
Spring, in turn, sends a response context type image/gif
 
So, my questions are, ¿how relevant is the response content type returned to process the data parameter as a json response? ¿is there any possibily to add request accept headers in IE environment? Perhaps the error is somewhere else, and it has nothind to do with headers...