In my attempt to pop up a download box in the client window (for the sqlite3.db file). I have written this code:
#! / Usr / bin / env python import os # HTTP header print "content-type: application / octet-stream; name = \" sqlite3.db \ "\ r \ n"; Print "Content-Disposal: Attachment; Filename = \" sqlite3.db \ "\ r \ n \ n"; # Will listen to the actual file content. Fo = open ("sqlite3.db", "rb") str = fo.read (); Print straw # close opend file fo.close () I'm experiencing an error (copied from error log) "IOError: [Errno 2] such There are no files or directories: 'Sqlite3.db' "
I have pasted both python.py and sqlite3.db in / var / www / cgi-bin / and I have both 0755 chmod is assigned.
I checked by Hello World script printing by configuration.
Any idea what my mistake is? I am still confused where should I provide the path to downloadable files?
HTTP header initially expires ( print new line )
print "content-type: application / octet-stream; name = \" sqlite3.db \ "\ r \ n"; Print "Content-Disposal: Attachment; Filename = \" sqlite3.db \ "\ r \ n \ n"; should have Ebob lines:
print 'content-type: application / octet-stream; Name = "sqlite3.db 'print' content-dispute: attachment; filename =" sqlite3.db "print
No comments:
Post a Comment