> I have a simple file upload form.  It works exactly as expected
> without javascript.  It *almost* works as expected when I convert it
> to an ajax form, with something like form.ajaxSubmit(options).  My
> options contain a dataType definition, {'dataType' : 'json'}.  I
> believe that this directly relates to the HTTP Accept header and lets
> my server know the type of data that I'm expecting to get back.  If I
> don't select a file to upload and hit submit then the Accept header is
> populated correctly ("application/json, text/javascript, */*").  If I
> do select a file to upload and hit submit then the Accept header
> ignores my dataType and appears to default to the browser default
> (something like "text/html,application/xhtml+xml,application/
> xml;q=0.9,*/*;q=0.8").  In practice, this means that although the file
> is uploaded correctly, I'm unable to determine the the type of
> response required from the server (in Rails I can't use respond_to to
> detect a request for a js response).  I'm wondering whether this is by
> design or whether something's wrong here.

File uploads don't use ajax, the form plugin only makes it appear that
way.  A true browser submit takes place when uploading a file.

Reply via email to