I have a django app that runs on both linux and windows. One request
that it processes contains PNG files encoded as an octet-stream on the
client. The server gets an object of type
django.core.files.uploadedfile.TemporaryUploadedFile and it does this
to save the files on disk:

with open(fn, 'wb') as fd:
    fd.write(request.FILES[key].read())

When the server is running on linux this works perfectly - i.e. the
PNG files are saved to disk properly and can be opened and viewed. But
when the server is running in Windows the PNG files are corrupt when
saved. I don't really know why that is, but my WAG is that it's due to
the file being binary. I did try this but it still failed:

with open(request.FILES[key], 'rb') as fd:
    data = fd.read()
with open(fn, 'wb') as fd:
   fd.write(data)

So perhaps that is not the issue.  Anyone have any idea on what could
be the issue and/or how I can debug this?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY5NJYVFzk6ojf4zn%2Bi7%3Dqt-7%2BziLS4VoU-NxgGs5nhtuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to