When trying to download a CSV export file, I'm getting an error in IE7 (but not in Firefox):
"Internet Explorer was not able to open this Internet Site. The requested site is either unavailable or cannot be found. Please try again later."
This seems to be a wider issue with cache control settings in the Drupal header:
http://drupal.org/node/18565
The error doesn't appear when the following IE7 option is checked: Tools - Internet Options, Advanced Tab, Security heading (almost all the way at the bottom), Do not save encrypted pages to disk.
Unfortunately, that setting is de-selected by default.
Based on the thread http://drupal.org/node/18565 , I've inserted the following line of code after the line 185:
drupal_set_header("Cache-Control: no-store, no-cache, must-revalidate");
This makes it work for IE, but might result in "unclean" code (I'm new to Drupal coding).
P.S.: I suppose the DOC export would have the same problem; but I didn't try.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 255387-views_bonus_export-1.2-alpha1-6.patch | 759 bytes | xurizaemon |
| #4 | views_bonus_export-255387-4.patch | 790 bytes | xurizaemon |
Comments
Comment #1
dmitrig01 commentedFixed.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
rajesharma commentedHi All ,
I have one working solution for this problem.
we dont have to make any drupal code changes here and there.
just work in the drupal way.
first create a new menu for download page.
like this...
$items[] = array(
'path' => 'addressbook/download',
'callback' => 'download_addressbook',
'access' => user_access('manage addressbook'),
'type' => MENU_CALLBACK,
);
after that create your function which will gather the download data and store it in a $_SESSION variable
function yourfunction()
{
$_SESSION['filearray']['data'] = $csvString; //your data
$_SESSION['filearray']['name'] = "address_book.csv"; //'filename for download'
$_SESSION['filearray']['mime'] = "text/csv"; /'mime type'
$_SESSION['filearray']['size'] = strlen($csvString); //length of the data
after storing data in session just redirct to that page
header('location:?addressbook/download');
die();
}
function download_addressbook()
{
if(isset($_SESSION['filearray']['data']) && trim($_SESSION['filearray']['data'])!="")
{
force_download($_SESSION['filearray']['data'],$_SESSION['filearray']['name'],$_SESSION['filearray']['mime'],$_SESSION['filearray']['size']);
}
else
{
header('location:?q=addressbook/view');
die();
}
}
function force_download ($data, $name, $mimetype='', $filesize=false) {
// File size not set?
if ($filesize == false OR !is_numeric($filesize)) {
$filesize = strlen($data);
}
// Mimetype not set?
if (empty($mimetype)) {
$mimetype = 'application/octet-stream';
}
// Make sure there's not anything else left
// ob_clean_all();
// Start sending headers
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Transfer-Encoding: binary");
header("Content-Type: " . $mimetype);
header("Content-Length: " . $filesize);
header("Content-Disposition: attachment; filename=\"" . $name . "\";" );
// Send data
echo $data;
die();
}
thanks regards
Rajesh
Comment #4
xurizaemonThis was fixed in May, but it seems the update hasn't been released in a stable version yet?
I think this fix should do it (seems to work for me to prevent issues with download on IE6/IE7)
Comment #5
steingard commentedI applied this patch and I'm still having trouble on this issue.
The patch did return with 1 error out of 2 HUNKS...?
It produced a views_bonus_export.module.rej file that states
Comment #6
xurizaemon@steingard - here's the same patch for 5.x-1.2alpha2 - please try this instead and report back if it works?
Comment #7
steingard commentedThe patch file worked nicely, thanks!
Something that is important to remember... is to setup the Views Export permissions properly (in addition to the View's perms).
Comment #8
steingard commentedThis patch needs to find its way into the contributed module.
Comment #9
pomliane commentedThis version of Views Bonus Pack is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.
This issue has been automagically closed by a script.