title: How to send a file from Django backend to server
body: <p>I am sending an ajax request with a file to my backend that processes it. After processing it into another form (image into a compressed processed directory), I want to send that back to the user to down load that. Can someone provide an example view that will, when it receives the file, process the data the send a request that has the file. Also, please show me how to download that file in the javascript front end.</p>
  
  <pre><code>class send_text:
      def post(self, request):
          file = request.POST["file"]
          # Processing…………… file_to_send = &lt;path to file&gt;
          # show how to send the file here
  </code></pre>
  
  <p>Also the frond end:</p>
  
  <pre><code>$.ajax{
  //sending the data
  onSuccess: //show how to download the data here
  }
  </code></pre>
  
  <p>Thank you in advance.</p>