download

Downloading a file using JSF

匆匆过客 提交于 2021-02-11 14:00:43
问题 Hi I am trying to download a file from server but at the end of my process I end up with only numbers and some weird characters on my browser. It's not downloading the file. I am using seam and JSF 1.2. Here is my code: public void writeBytesToResponse(UploadDefinition _instance, String path) { FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context .getExternalContext().getResponse(); try { byte[] bytes = getFile(path); response

HttpHandler not retaining filenames on download

本小妞迷上赌 提交于 2021-02-11 13:00:44
问题 I am using an HttpHandler to serve documents within my ASP.NET web application. I can get it to work just fine with one issue which I can't quite figure out -- the filename isn't retained. For example, if I am trying to serve a document called "New Patient Information Form.docx" and my handler is called "GetDocument.ashx" the file is downloaded as "GetDocument.docx" and "GetDocument(1).docx", "GetDocument(2).docx" etc. each time I download the file. I want to use a handler instead of linking

c# files downloaded with httpwebrequest and cookies get corrupted

僤鯓⒐⒋嵵緔 提交于 2021-02-11 06:09:33
问题 I am trying to make a program which is able to download files with URI(URL) using httpwebrequest and cookies(for credential information to keep login status). I can download files with following code but files get corrupted after being downloaded. when I download xlsx file(on the web page) into text file at local drive, I see some part of numbers and words from an original file in a corrupted file, therefore I assume I have reached to the right file. however, when I download xlsx file(on the

c# files downloaded with httpwebrequest and cookies get corrupted

风格不统一 提交于 2021-02-11 06:08:35
问题 I am trying to make a program which is able to download files with URI(URL) using httpwebrequest and cookies(for credential information to keep login status). I can download files with following code but files get corrupted after being downloaded. when I download xlsx file(on the web page) into text file at local drive, I see some part of numbers and words from an original file in a corrupted file, therefore I assume I have reached to the right file. however, when I download xlsx file(on the

c# files downloaded with httpwebrequest and cookies get corrupted

人盡茶涼 提交于 2021-02-11 06:07:14
问题 I am trying to make a program which is able to download files with URI(URL) using httpwebrequest and cookies(for credential information to keep login status). I can download files with following code but files get corrupted after being downloaded. when I download xlsx file(on the web page) into text file at local drive, I see some part of numbers and words from an original file in a corrupted file, therefore I assume I have reached to the right file. however, when I download xlsx file(on the

c# files downloaded with httpwebrequest and cookies get corrupted

放肆的年华 提交于 2021-02-11 06:06:46
问题 I am trying to make a program which is able to download files with URI(URL) using httpwebrequest and cookies(for credential information to keep login status). I can download files with following code but files get corrupted after being downloaded. when I download xlsx file(on the web page) into text file at local drive, I see some part of numbers and words from an original file in a corrupted file, therefore I assume I have reached to the right file. however, when I download xlsx file(on the

shiny htmlOutput() – export to pdf

天大地大妈咪最大 提交于 2021-02-11 00:57:41
问题 I want to export html objects from shiny app to pdf. In order to export table, I was using .Rmd template (based on How to make pdf download in shiny app response to user inputs?), however I do not know how to pass html object to PDF in shiny app. Example app: library(shiny) ui <- shinyUI( fluidPage( fluidRow( column(width=4, htmlOutput("Table1"), htmlOutput("Table2"), htmlOutput("Table3") )) ) ) server <- shinyServer(function(input, output, session){ #****************************************

Downloading multiple files with requests in Python

心不动则不痛 提交于 2021-02-10 23:42:19
问题 Currently im facing following problem: I have 3 download links in a list. Only the last file in the list is downloaded completely. The others have a file size of one kilobyte. Code: from requests import get def download(url, filename): with open(filename, "wb") as file: response = get(url, stream=True) file.write(response.content) for link in f: url = link split_url = url.split("/") filename = split_url[-1] filename = filename.replace("\n", "") download(url,filename) The result looks like

Downloading multiple files with requests in Python

天涯浪子 提交于 2021-02-10 23:38:38
问题 Currently im facing following problem: I have 3 download links in a list. Only the last file in the list is downloaded completely. The others have a file size of one kilobyte. Code: from requests import get def download(url, filename): with open(filename, "wb") as file: response = get(url, stream=True) file.write(response.content) for link in f: url = link split_url = url.split("/") filename = split_url[-1] filename = filename.replace("\n", "") download(url,filename) The result looks like

Dash download in-memory generated file on button click: How to give filename?

回眸只為那壹抹淺笑 提交于 2021-02-10 18:21:46
问题 I generate an in-memory Excel file via pd.ExcelWriter and BytesIO for a click event in my Python3.8 dash app. Everything works as it should be. When I download my file I get this popup message asking me if I would like to continue to download/open the generated file. However, the popup message shows this (I guess base64 encoded) string (or path?), e.g. ...ydaHdjhgk328AAAAnxsAA== and after downloading the download gets a (randomly assigned?) set of characters as the filename (e.g. ZySzsdn1