title: DJANGO FORM - how to change save location file uploaded
body: <p>i don't use models form but only form. How to change location file when i uploaded? i want the file just go to /mp3 folder. And now it not move to anything (the file didn't got upload).</p>
  <p>and this my code :</p>
  <pre><code>def homepage(request):
  if request.method == &quot;POST&quot;:
      form = Audio_store(request.POST, request.FILES)
      #  form = AudioForm(request.POST, request.FILES)
      if form.is_valid():
           handle_uploaded_file(request.FILES['record'])
      return render(request, &quot;homepage.html&quot;, {'form': form})
  else:
        return render(request, &quot;homepage.html&quot;)
  
  
  def handle_uploaded_file(f):
      with open('mp3', 'wb+') as destination:
          for chunk in f.chunks():
              destination.write(chunk)
  </code></pre>
  <p>forms.py :</p>
  <pre><code> from django import forms
      
      class Audio_store(forms.Form):
          record=forms.FileField()
  </code></pre>
  <p>urls.py:</p>
  <pre><code>urlpatterns = [
       url(r'^admin/', admin.site.urls),
       url(r'^decode/$', views.decode),
       path(&quot;&quot;, views.homepage, name=&quot;upload&quot;)
   ]
  
  if settings.DEBUG: #add this
      urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  </code></pre>
  <p>html :</p>
  <pre><code>&lt;form method=&quot;POST&quot; enctype=&quot;multipart/form-data&quot;&gt;
                              {% csrf_token %}
                              {{form}}
                              &lt;button type=&quot;submit&quot; class=&quot;dsnupload&quot;&gt;
                                  &lt;i class=&quot;large material-icons&quot; style=&quot;font-size: 50pt; margin-top: 10px;&quot;&gt;audiotrack&lt;/i&gt;
                                  &lt;p style=&quot;font-weight: bold; color: white;&quot;&gt;Insert file audio (mp3)&lt;/p&gt;
                              &lt;/button&gt;
                            &lt;/form&gt;
  </code></pre>
  <p>and my error msg :
  <a href="https://i.stack.imgur.com/qJZyj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qJZyj.png" alt="cannot upload" /></a></p>
  <p>my folder:
  <a href="https://i.stack.imgur.com/Keq8u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Keq8u.png" alt="folder" /></a></p>