On Sep 20, 7:47 am, zweb <traderash...@gmail.com> wrote: > When I try to download a file through django in IE , I get > > [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] response = > func(request, response), referer:http://www.....com > [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] File "/home/ > pmc/webapps/test/lib/python2.5/django/http/utils.py", line 77, in > fix_IE_for_vary, referer:http://www......com/ > [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] if response > ['Content-Type'].split(';')[0] not in safe_mime_types:, > referer:http://www.....com/ > [Sun Sep 20 05:34:20 2009] [error] [client 127.0.0.1] AttributeError: > 'list' object has no attribute 'split', referer:http://www.....com/ > > I am doing, > > for f in range(len(filepath)): > file_data = open('%s' % (filepath[f]), "rb").read() > response = HttpResponse(file_data,mimetype= content_type) > response['Content-Disposition'] = 'filename ='+ fname > return response > > where content_type is same as content Type of uploaded file
What is the for loop for? Why are you iterating over filepath? The first time through, you open a file whose path is just the first character in filepath - why? And what's more, you return immediately, so you never do the rest of the loop. Anyway, that's not the problem. content_type is obviously not what you think it is. Try putting 'print content_type' at the start to see what it actually is. -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---