title: multipart/form-data submit vs text/xml response
body: <p>I use Python script serve uploading files to a server. The upload form is served by <code>jQuery.form</code></p>
  
  <p><em>HTML:</em></p>
  
  <pre><code>&lt;form id="form_upload" enctype="multipart/form-data" action="py/uploader.py" method="POST"&gt;
  &lt;input type="hidden" name="MAX_FILE_SIZE" value="100000" /&gt;
  &lt;input name="uploadedfile" type="file" /&gt;
  &lt;input type="submit" value="Upload" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>At the end of the upload procedure, I want the <code>uploader.py</code> to return me some information about the uploaded file. I return this information in xml format and later want to interpret it by jQuery. </p>
  
  <p><em>uploader.py:</em></p>
  
  <pre><code># ...
  # serve the file
  return "&lt;info size=\"%s\"&gt;&lt;/info&gt;" % size
  </code></pre>
  
  <p>The jQuery should then look like that:</p>
  
  <p><em>jQuery:</em></p>
  
  <pre><code>$("#form_upload").submit( function() {
      var options = {
          dataType: "xml",
          success: function(xml_response) { /*xml_response is the xml returned by uploader.py*/
              var size = $(xml_response).find("info").attr("size");
              // display size
              // ...
          }
      }
  
      $(this).ajaxSubmit(options);
      return false;
  });
  </code></pre>
  
  <p>Now, the problem is that xml_response is not recognized as my xml: instead of the string I produced, I get </p>
  
  <p><code>&lt;pre style="word-wrap: break-word; white-space: pre-wrap;"&gt; here my xml, escaped &lt;/pre&gt;</code></p>
  
  <p>If the <code>enctype</code> in the <code>form</code> was <code>text/xml</code> , then <code>success</code> function recieves right xml object, but then uploading a file is impossible. How to solve that?</p>