On Wed, Feb 18, 2009 at 10:50 AM, phoebebright <phoebebright...@gmail.com> wrote: > > The javascript makes a call to this view on submitting the form that > uploads the image. > > def uploadimage(request): > try: > upload_full_path = settings.CONTENT_IMAGES > > upload = request.FILES['image'] > dest = open(os.path.join(upload_full_path, > upload.name), 'wb+') > > for chunk in upload.chunks(): > dest.write(chunk) > > dest.close() > > result='{status:"UPLOADED",image_url:"%s%s"}' % > (settings.CONTENT_IMAGES_URL, upload.name) > > return_data = HttpResponse(result,mimetype='Content- > Type: text/ > html') > > except Exception, e: > return_data = HttpResponse("Error in uploading image") > > return_data.flush() > > return return_data > > In Firefox/Mac it uploads the file and returns > "{status:"UPLOADED",image_url:"/site_media/content/ > dalston_cranes.JPG"}" to javascript which tells javascript all went > well. In IE/Safari the file is uploaded successfully but the above > text is downloaded as a file called something like 2s6OP6WO(2).part so > control doesn't return to the javascript. Have applied a similar > program in PHP and it works fine. Tried different mime types and tried > to trace what is going on but without progress. > > Phoebe > > > On Feb 18, 2:33 pm, Almost George <almostgeo...@almostexciting.com> > wrote: >> On Feb 18, 5:36 am, phoebebright <phoebebright...@gmail.com> wrote: >> >> > There is something different about the way django is handling to response >> > to php I think. >> >> I use the YUI Rich Editor in admin, and have no problems. I know >> debugging isn't as easy in IE as others, but do your best to find out >> the exact response (mostly, response headers) that's being sent to the >> browser. Also, could you clarify the above "response to PHP" >> statement? Perhaps explaining the technical details of what's going on >> would be of some help? > > >
Tools like Tamper Data (firefox extension) or WebScarab (standalone proxy) let you examine all the header values sent with an HTTP request. You could use this to compare the exact headers returned by PHP vs. Django, and fix any differences in the Django response. Colin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---