reading/writing files

S

sandipm

Hi,

I am trying to read a file and write into other file. if I do it for
simple text file, it works well.
but for pdfs or some other mime types, its failing.

actually main problem is i am uploading file using cgi, in this
process I am getting content of file, and I am
trying to save the file. I think I need to specify mimetype of file
somehow..?
any quick solutions? or need to google.

sandip
 
S

sandipm

f1= open("file1.pdf", "rb")
x = f1.read()
open("file2.pdf", "wb").write(x)



works...

thanks
sandip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top