CSV file not open in IE - php

I have create a CSV file in my php code,
after create CSV, I try to open the CSV using window.open(),
this will work fine all browser except IE 7 and IE 8,
in IE a new window open then it close automatically
how to solve this problem,

If I recall, Internet Explorer has a peculiar quirk when trying to open files, even if the proper MIME type is set in the header.
You may need to do the following to get the CSV to download:
Go to Tools > Internet Options
Select the Security tab, then press the Custom Level... button
Scroll down to the Downloads section, and under Automatic prompting for file downloads select Enable
Hopefully, that should resolve the issue.

Try adding the following at the beginning of your script:
header('Content-Disposition:inline');
This should direct the browser to display the file instead of prompting a download, which may be the problem.

Related

Compress file with PHP make webpage is not avaiable

Recently, my client website is collapsed in some certain page, not the whole website.
When open the C page (collapsed page for short) in Chrome, it will inform "The webpage is not available"
Error 330 (net::ERR_CONTENT_DECODING_FAILED)
It looks like a problem with this option in my client's PHP file:
ob_start('ob_gzhandler');
When I removed it, the C page is back to work normally but the page is no longer compressed as before.
I tried to add it back with this code in some Google source at the end of page but now whole website collapsed so I can't put this option to PHP file now:
ob_end_clean();
ob_flush();
Is there any safe way to enable compression for website now?
I tried with .htaccess but it didn't work.
The site is using IIS server with Windows Server 2008.

Html2pdf error when downloading a pdf file in remote server

I'm using yii with html2pdf version 4.03 for downloading pdf documents in my project. The pdf documents consist of tables with many rows because they are reports. In my localhost, the download is fine. But when I do that in remote server, it can't be downloaded.
I used Firefox to download it. When I downloaded it, it prompted an alert message saying that I can't download because the source file cannot be read. When I force to download it (by pressing refresh button in firefox's download list), the pdf file is there. When I tried to open it, it says that the file is corrupted.
If I delete a few rows, it can be downloaded just fine. Strangely, even if I didn't delete the rows, they are still in one page. So the problem shouldn't be about "table row that doesn't fit in one page", should it?
What could be the problem? Could anyone help me with this please?
UPDATES
when I print it in browser instead of downloading, firefox prompts an error like below:
Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
Please contact the website owners to inform them of this problem.
Still don't know how to solve this though...
Save the generated pdf, open it in text editor, and see what error message is there.

Download Link not working in html

i am trying to make a download link in html that is given like this for a PDF Book
Download
but problem is that when download link is clicked it opens online version of pdf , does not offer download , i did google and found same way to add download link , any one can guide me with it please whats wrong here
As of late 2018, clicking the link won’t trigger a download if the resource to be downloaded wasn’t served from the same origin or same server. Apparently, this is restriction is a security measure.
You can download the content in browser and make it downloadable, you can check the below url
https://medium.com/charisol-community/downloading-resources-in-html5-a-download-may-not-work-as-expected-bf63546e2baa
you can try this
Download
HTML5 defines the download attribute, which forces the browser to prompt the user a download dialog for the resource instead of navigate to it.
Here is the support across the different browsers: http://caniuse.com/#feat=download.
Its not the problem with your script, instead its your browser that has pdf plug-in and displays you the content file directly.You can just save the page (Press CTRL+S) and it would be saved as .PDF file.
Thanks.
The HTML5 download attribute is only supported by Chrome and firefox... Try this :
Download
Download.php
header("Content-disposition: attachment; filename=http://www.mydomain.org/pdf/book.pdf");
header("Content-type: application/pdf:");
readfile("http://www.mydomain.org/pdf/book.pdf");
if you want to download the pdf in next tab with current website intact then use following code:
Download

Server doesn't show file replacement until I open it in my file explorer

So I am running xampp and wordpress. I have an image uploaded to the uploads directory named "avatar.jpeg". It displays just fine. But when I delete it and upload a new image file named "avatar.jpeg", the server doesn't reflect the change and just shows the old file. But when I open the file in Eclipse or my explorer, then the server starts showing the change and displays the new image.
This is probably something basic which I never learned about. I tried chmod to set the file permissions on the new file but that didn't help.
The file will be cached in your browser. To force a reload, append an arbitrary variable to your file, e.g. <img src="yourfile.jpg?1234567" />
I also guess it's a caching issue like freddy K. does.
I would suggest to configure ETags on your Server.
Simply appending something to the URL may only help you when the appended string is changing on every update of the requested file(using the current timestamp or similar all the time will force the client to download the file on every request and slow down the page).
http://httpd.apache.org/docs/2.0/mod/core.html#fileetag

What HTTP headers do I need to stream an ASF file?

I have a simple PHP script that will either serve up a streaming ASF file or not, depending on whether you're logged in and have access to the file. It basically does this:
<?php
header('Content-Type: video/x-ms-asf');
header('Content-Disposition: inline; filename="file.asf"');
readfile('file.asf');
?>
This already works fine in Firefox; when you navigate to this file it starts the video streaming right away. But Internet Explorer is a different story. When I go to this link in IE, it consistently tries to download the file as if it were an attachment rather than streaming it in the browser. What I am missing that IE's getting hung up on?
I don't think you need to add the Content-Disposition. Did you try removing it?
It look like that your IE or Media Player isn't correctly configured. Check this link link text for more details.
From your description, it sounds like your IE is configured to save a .asf file rather than stream it. Perhaps you can try opening a similar file on your local drive in IE to check whether it's configured to stream it.

Categories