LF being converted to CRLF when uploading binary files

View: New views
2 Messages — Rating Filter:   Alert me  

LF being converted to CRLF when uploading binary files

by Ideanee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


We are having a problem with LF being converted to CRLF when uploading
binary files. We are using:

   Windows Server/Windows XP
   Cherrypy 3.0.3
   Python 2.5

The method to write the uploaded file looks like:

    def upload(self, htSinkImageFile):
              shutil.copyfileobj(htSinkImageFile.file, open("/
test.gif","w"));

If I compare the uploaded file to the original the LFs have been
converted to CRLF. Does anyone know how to configure cherrypy so that
it does NOT convert LFs to CRLFs on binary files?

Thanks, any help would be appreciated.





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: LF being converted to CRLF when uploading binary files

by Gloria W :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Try opening the file in binary mode instead:
"wb"
instead of "w"

Gloria

> We are having a problem with LF being converted to CRLF when uploading
> binary files. We are using:
>
>     Windows Server/Windows XP
>     Cherrypy 3.0.3
>     Python 2.5
>
> The method to write the uploaded file looks like:
>
>      def upload(self, htSinkImageFile):
>                shutil.copyfileobj(htSinkImageFile.file, open("/
> test.gif","w"));
>
> If I compare the uploaded file to the original the LFs have been
> converted to CRLF. Does anyone know how to configure cherrypy so that
> it does NOT convert LFs to CRLFs on binary files?
>
> Thanks, any help would be appreciated.
>
>
>
>
>
> >
>
>    


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---