force-download

Codeigniter: download file and redirect

江枫思渺然 提交于 2020-01-14 19:18:08
问题 I have a form on this page http://www.obsia.com/products/thassos_wonder_brochure/ On hitting submit, I want it start downloading the file and also get redirected to thank you page. But I can only get it either download the file or redirect or load the thank for downloading page. This is the function for checking the form and submiting: function thassos_wonder_brochure() { $this->load->helper('form'); $this->load->helper('email'); $this->load->library('email'); $this->load->library('form

Browser file download not working for a file stored on server

时光毁灭记忆、已成空白 提交于 2020-01-06 03:32:05
问题 I have a file on server which is to be downloaded using the browser download. No error is being thrown but no download window appears for the file download. Please help. My controller code is: @RequestMapping(value = "download", method = RequestMethod.GET) public void downloadFile( @ModelAttribute("path") final String path, HttpServletRequest request, HttpServletResponse response) throws Exception { try { logger.error("inside download get try"); ServletContext context = request

Force file download PDF 'open with' box says its a Firefox document ??

我的未来我决定 提交于 2020-01-03 03:03:31
问题 I am trying to force download a PDF file, Everything works fine. Only problem is when it show a "Download box" it says its a "Firefox Document" which actually should say "Adobe Acrobat Document". See the images, and below is the code i am using 1) Force download box from gmail, which works fine 2) Force download box from my application, which says "Firefox Document" header("Pragma: public"); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header("Cache-Control: must-revalidate, post-check=0

Forcing the browser to download a docx file in JAVA generates a corrupted document

房东的猫 提交于 2019-12-31 04:40:07
问题 Using JAVA, I'm trying to force the browser to download files. Here is the code I currently use: response.reset(); response.resetBuffer(); response.setContentType(mimeType); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); InputStream in = new FileInputStream(file); OutputStream out = response.getOutputStream(); IOUtils.copy(in, out); out.flush(); out.close(); in.close(); response.flushBuffer(); It works almost well, but when forcing the download of a

force download using ZF2

耗尽温柔 提交于 2019-12-29 17:46:07
问题 I am trying to do force download using ZF2. Here is the snippet to my code use Zend\Http\Request; ..... public function downloadAction() { $response = new Request(); $response->setHeaders(Request::fromString("Content-Type: application/octet-stream\r\nContent-Length: 9\r\nContent-Disposition: attachment; filename=\"ultimate_remedy_readme.txt\"")); } now i am getting this error /var/www/whowantsmymoney/vendor/zendframework/zendframework/library/Zend/Http/Request.php:88 Message: A valid request

force download using ZF2

天大地大妈咪最大 提交于 2019-12-29 17:45:52
问题 I am trying to do force download using ZF2. Here is the snippet to my code use Zend\Http\Request; ..... public function downloadAction() { $response = new Request(); $response->setHeaders(Request::fromString("Content-Type: application/octet-stream\r\nContent-Length: 9\r\nContent-Disposition: attachment; filename=\"ultimate_remedy_readme.txt\"")); } now i am getting this error /var/www/whowantsmymoney/vendor/zendframework/zendframework/library/Zend/Http/Request.php:88 Message: A valid request

PHPExcel Force Download Issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:37:05
问题 I know this might have been asked in several pieces, but I could not find an exact answer to the issue. I am using PHPExcel to generate an Excel file (obviously), and the code works to generate the file, but not when I include the code for Force Download, it corrupts the file. My latest version of the script looks like this: function make_xls_spreadsheet(){ /** Error reporting */ error_reporting(E_ALL); /* Set the save path */ define('XLSX_SAVE_PATH', 'tmp/'); /** Include path **/ set_include

How to force download an image without a script, but with $_GET?

无人久伴 提交于 2019-12-25 03:26:10
问题 I have seen this method being used on about three sites now, including Facebook, Dropbox and Microsoft's Skydrive. It works like this. Let's say you want to look at the image without downloading, then you'd just do this. https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-xxxx/xxx_xxxxxxxxxxxxxxx_xxxxxxxxx_o.jpg But if I want to download it, I'd add ?dl=1 https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-xxxx/xxx_xxxxxxxxxxxxxxx_xxxxxxxxx_o.jpg?dl=1 Easy peasy right? Well, it's probably not easy on

How can I download file in codeigniter?

妖精的绣舞 提交于 2019-12-24 03:27:31
问题 I am trying to download file in my codeigniter web application using javascript and codeigniter controller, it shows the file contents in ASCII format but not download the file directly view.php <a href="javascript:prd_download(this)">Download</a> <img src="<?php echo site_url()."/../images/uploads/".$jobno."/thumb_".$prd_row->filename; ?>" alt="Loading Image..." > <input type="checkbox" name="img_check" id="img_check" class="img_check" image="<?php echo $prd_row->filename ?>"> <script type=

How to force download of big files without using too much memory?

余生颓废 提交于 2019-12-18 15:39:11
问题 I'm trying to serve large zip files to users. When there are 2 concurrent connections, the server runs out of memory (RAM). I increased the amount of memory from 300MB to 4GB (Dreamhost VPS) and then it worked fine. I need to allow a lot more than 2 concurrent connections. The actual 4GB would allow something like 20 concurrent connections (too bad). Well, the current code I'm using, needs the double of memory then the actual file size. That's too bad. I want something like "streaming" the