I have a very simple python script to download a jpg image to client, but it always return a broken image.
Really don’t know what’s missing. Can anyone help?
Here is the code:
import sys
filename = r"path\\image.jpg"
sys.stdout.write( "Content-Disposition: attachment; filename=image.jpg\\r\
"
+ "Content-Type: image/jpeg\\r\
\\r\
"
+ file(filename,"rb").read())
Here are the images on the server and downloaded: