title: I/O operation on closed file when saving a model
body: <p>Hi guys i have my problem in this part in the code. I have multiple files uploaded from o global variable. </p>
  
  <pre><code>file_car = None # Global variable
  </code></pre>
  
  <p>and in my views.py</p>
  
  <pre><code>    if request.method == 'POST':
           if file_car is None:
           print request.FILES
           file_car = [request.FILES.get('dzfile[%d]' % i)
           for i in range(0, len(request.FILES))]
  </code></pre>
  
  <p>I need to use like this because I need to use this images in a lot of other views. But the problem is when I want to save </p>
  
  <pre><code> for f in file_car:
              print f
              myfyle= File(f)
              #myfyle.open()
              aux = Attachment()
              aux.name= f
              aux.car = car
              aux.save() # here is the error. I tried opening the file but it said you cannot reopen the file
  </code></pre>
  
  <p>It throw me I/O operation on closed file.I'm going crazy with this. Sorry for my bad english</p>
  
  <p>Edit Here is a more compressive code if it helps</p>
  
  <pre><code> from django.core.files import File
  def createCarView(request):
          global file_car
          if request.method == 'POST': 
              if file_car is None:
                  form = CarForm(request.POST, request.FILES) # other valus
                  print request.FILES # Print all the file that I get
                  file_car = [request.FILES.get('dzfile[%d]' % i)
                      for i in range(0, len(request.FILES))] # Have all the fileS!
                  if form.is_valid():
                              # omitted all the other part of the form!    
                              car.save()  
                              for f in file_car:
                                print f
                                #myfyle.open()
                                aux = Attachment()
                                aux.name=myfyle
                                aux.car = car
                                aux.save() #Error in here
                                print aux.name
                                file_car=None # cleaning the global var     
                                return HttpResponseRedirect('/car/create') 
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>class Attachment(models.Model):
      car = models.ForeignKey('Car', on_delete=models.CASCADE)
      name = models.FileField(_('File'),
          upload_to=upload_to_get,
          )
  </code></pre>