title: Django FileField in model, S3 Storage + Boto, 400 Bad Request
body: <p>I'm developing a web application in Django, and one of its features is adding new articles with a photo.</p>
  
  <p>My <code>Article</code> model class contains <code>models.FileField</code>. I use <code>S3BotoStorage</code> as <code>DEFAULT_FILE_STORAGE</code> (Amazon S3).</p>
  
  <p>Users can add a photo to an article in two ways:<br>
  1) Upload a photo from disk (by using <code>input type=file</code>)<br>
  2) Paste URL to existing photo online</p>
  
  <p>If users uses option 1), everything works. I get uploaded file in view from <code>request.FILES</code> dictionary and assing it to <code>FileField</code> in <code>Article</code> object. The photo is uploaded to S3.</p>
  
  <p>But when user pastes URL to a photo, the first thing I have to do in view is to download this photo. I do it by using function:</p>
  
  <pre><code>def downloadPhotoFromURL(url):
  try:
      img = urllib.urlretrieve(url)[0]
      return img
  except Exception:
      return None
  </code></pre>
  
  <p>Then I save this image to <code>FileField</code> in model, so my whole code responsible for downloading image, and uploading it to S3 is like this:</p>
  
  <pre><code>articleImg = downloadPhotoFromURL(url)
  f = File(open(articleImg), 'rb')
  newArticle.image.save('tmp', f)
  </code></pre>
  
  <p>In this situation, I cannot upload it to S3 and after 2 minutes I'm receiving <code>BotoServerError: 400 Bad Request</code>. Unfortunately I don't have any other information why this request is bad. Any idea what can be going wrong? By the time I saved an image to model, I had saved a model, so model exists when I try to upload photo to S3.</p>