Hello, When creating a working with the models and views to upload files what is the difference between models.FileField and forms.FileField? Just a practical usage explanation would be good at this point.
i can't find any comparison of the two but django directions and examples use one or the other. I've gotten forms that use models.FileField calls to work but the forms.FileField seems to act up. For example this general django directions use the form.fileField: from django import forms class UploadFileForm(forms.Form): title = forms.CharField(max_length=50) file = forms.FileField() def upload_file(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): handle_uploaded_file(request.FILES['file']) return HttpResponseRedirect('/success/url/') else: form = UploadFileForm() return render_to_response('upload.html', {'form': form}) def handle_uploaded_file(f): destination = open('some/file/name.txt', 'wb+') for chunk in f.chunks(): destination.write(chunk) destination.close() All the chunks() calls and others seem helpful but the models.FileField ( upload to = /somedir) gets things done in a snap. Any recommendations? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.