python - Problems with Tornado Web Server filedownlaod -
broth web server
I have a question
I have a Tornado web server How do I download files?
This is my code. I ('content type', 'app / apk') itself .set_header ('content-break', 'attachment; filename =% s'% 'test.apk') F = file ('test.apk') itself Write (F.PD) self.finish ()
-
I'v gets a file with unreadable content such as "asdfafasfd a ??? ?? ?? ???? ???? ???? ???? ???? ???? ???? ???? ???? ???? \ N ') is unreadable.
-
APK, image file etc. I can download but the file size is 0k or 1k
How can I file several types of files (Image, APK, etc.) Download Hurricane Web Server?
I want the example source code plz.
< Div class = "post-text" itemprop = "text">
Code Tow Down Nedo is for download file from the server, which I used to download the CSV file in my app. This can help you.
def post (auto, file name): print ('I'm downloading file handles:', file name) ifile = open (filename + ".csv", "r") itself .set_header ('content-type', 'text / csv') self.set_header ( 'Content-dispute', 'attachment; file name =' + file name + '') self.write (ifile.read ())
Comments
Post a Comment