Jump to content

[SOLVED] $_session problem


johnsmith153

Recommended Posts

I agree there should not be any relation between file download and $_SESSION, but:

 

The below scripts are the full code that is on the page.

 

This WORKS great:

//session_start();
$fileurl = "/home/account/folder1/folder2/file.xlsx";
$file= "file.xlsx";
header("Content-Disposition: attachment; filename=$file");
readfile($fileurl);

 

This DOES NOT:

session_start();
$fileurl = "/home/account/folder1/folder2/file.xlsx";
$file= "file.xlsx";
header("Content-Disposition: attachment; filename=$file");
readfile($fileurl);

Surely either I'm the idiot, or PHP is. Which one?

 

I would appreciate if someone can try this, I just can not understand why the below script will not download the file just because I set session_start()

 

Works fine, unless you set session_start()

 

//session_start();

$fileurl = "/home/account/folder1/folder2/file.xlsx";

$file= "file.xlsx";

header("Content-Disposition: attachment; filename=$file");

readfile($fileurl);

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.