Hi.

I'm in trouble here, when I try to upload a file and pass it to my
form for validation, it tells me that the form is not valid and that
there is no file.

But my request.FILES tab seems to be just fine..

Here's my code :

class AddMediaForm(forms.Form):
    file = forms.FileField()
    entry = forms.CharField(required=True, max_length=50,
widget=forms.HiddenInput())

def add_file(request):
    if request.method == 'POST':
        print request.FILES['file'].temporary_file_path()
        form = AddMediaForm(request.POST, request.FILES)
        print form.errors
        if form.is_valid():
            if
check_uploaded_file(request.FILES['file'].content_type):
                handle_uploaded_file(request.FILES['file'],
request.POST['entry'])
                return HttpResponseRedirect('/
entry/'+request.POST['entry']+'/manage')
            else:
                return HttpResponseRedirect('/error_typefile')
        else:
            return HttpResponseRedirect('/error_validation')
    else:
        return HttpResponseRedirect('/error_nofile')

<form enctype="multipart/form-data" method="post" action="/add_file/">
        {{ form_upload }}
<input type="submit" value="Upload" />
</form>

print request.FILES['file'].temporary_file_path() gives me the right
path (/tmp/..)


I'm with the last svn release.
Please someone help me. It works on another machine but I can't figure
out what is wrong here..

Thx


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to