On Tue, 2008-03-25 at 16:19 -0700, Carl wrote:
> Hi Djangonauts,
> 
> i've a problem here driving me nuts - obviously I don't get it how to
> do a simple file upload:
> 
> With a form like this:
> 
> <form action="." method="post" id="form" enctype="multipart/form-
> data">
>       <input type='file' name='foo'/>
>       <input type='submit' value='submit'/>
> </form>
> 
> and a view function like this:
> 
> def test(request):
>   if request.method=='GET':
>     return render_to_response('test.html')
>   else:
>     assert False, request.FILES
> 
> request.FILES has the following value (f. ex. a pdf):
> 
> <MultiValueDict: {'foo': [{'content': '<omitted>', 'content-type':
> 'application/pdf', 'filename': 'cheeseShop.pdf'}]}>
> 
> As far as I understand, this means the file wasn't uploaded
> ('content': '<omitted>').
> 
> I'm running the latest checkout and have set the MEDIA_ROOT and
> MEDIA_URL settings.
> 
> Anyone an idea why this doesn't work?

The reason Django displays <omitted> there is because most files are not
just a few bytes long. If we displayed the tens, hundreds or thousands
of kilobytes of data in the file content, it would completely swamp the
printed output. So we omit the content from the printed output.

If you actually look inside the dictionary, you'll see that the
"content" attribute has plenty of data there.

Regards,
Malcolm

-- 
On the other hand, you have different fingers. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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