Karen Tracey wrote:
> On Tue, Feb 17, 2009 at 11:50 AM, Tonu Mikk <tm...@umn.edu 
> <mailto:tm...@umn.edu>> wrote:
>
>     Alex Gaynor wrote:
>
>     > Uploaded files have a name attribute that contains their name.
>     Yes, but how does one take advantage of that in this code?
>
>
> You simply use the name attribute of the UploadedFile instance you are 
> working with.  For example, if you wanted to rewrite the example you 
> cited earlier to use the original name of the uploaded file, it would be:
>
> def handle_uploaded_file(f):
>    destination = open(f.name <http://f.name>, 'wb+')
>    for chunk in f.chunks():
>        destination.write(chunk)
>    destination.close()
Karen, thanks for this.  I don't quite see though how I can add the path 
info into this construct.  But here again, lack of Python experience is 
showing.

Tonu

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to