title: Alamofire MultiPartForm files in NSTemporaryDirectory
body: <p>I have not been able to find answer to my question anywhere so I figured I've ask.</p>
  
  <p>I am using <code>Alamofire 3.1.5</code> for uploading rather large volume of pictures, we are talking in hundreds of MB. </p>
  
  <p>There is a code snippet:</p>
  
  <pre><code>    self.manager.upload(.POST, url, headers: headers, multipartFormData: { multipartFormData in
                                  multipartFormData.appendBodyPart(fileURL: generalURL, name: "general", fileName: "general", mimeType: "image/jpeg")
                                  multipartFormData.appendBodyPart(fileURL: img1URL, name: "img1", fileName: "img1", mimeType: "image/jpeg")
                                  multipartFormData.appendBodyPart(fileURL: img2URL, name: "img2", fileName: "img2", mimeType: "image/jpeg")
                                  multipartFormData.appendBodyPart(fileURL: img3URL, name: "img3", fileName: "img3", mimeType: "image/jpeg")
                                  }, encodingCompletion: { encodingResult in
                                          .
                                          .
                                          .
  </code></pre>
  
  <p>As I understand Alamofire handles creating those request by saving them to disk, for better RAM optimalization. Which is smart and I am really happy about it. It just work flawless.</p>
  
  <p>On the other hand that means that it is basically <strong>doubling the data payload on disk.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/GqLDr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GqLDr.png" alt="enter image description here"></a></p>
  
  <p>The things is that those files a are not getting deleted, It even causes iOS default screen warning that the device is running low on free space.</p>
  
  <p>I know how to delete content of this directory, but in my current code flow it is safe to delete the content after all the request are finished, it may be even 100 requests, and each one of them takes roughly 20MB of payload. So the thing is that the device might not even have the capacity of storing this amount of data.</p>
  
  <p>My question is:</p>
  
  <p><strong>Can I make Alamofire to delete every single one of these files after it gets successfully uploaded?</strong></p>
  
  <p>Sorry for rather long question, I would post you a potato here, but this is not 9gag.</p>