473,378 Members | 1,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Session Problem with Header

150 100+
i'm having problem with session_start() to force the browser to download file with this function:

[PHP]
session_start();
function force_download($file){
if ((isset($file))&&(file_exists($file))) {
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="' . $file . '"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $file . '"');
readfile("$file");
} else {
echo "No file selected";
}
}
force_download("EGYMIDICA 2008.pdf");
[/PHP]
when i delete the session_start() function the browser download the file with no problem how can i solve this with session?
Dec 8 '07 #1
2 1252
Atli
5,058 Expert 4TB
Hi.

What is the problem?
Are you getting any errors?

As far as I can see, there is nothing wrong with that.
The only thing I can think of is that the session_start() function is generating a warning, in which case adding a @ sign in front of it may fix the problem.
Dec 9 '07 #2
smartic
150 100+
i need code that foce the Browser to download my file then redirct the page or close it how can i do that?
Dec 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
3
by: john | last post by:
Hi I am having a simple login & logout script which are as follow: login.php <?php session_start(); $_SESSION=$_POST; ?> logout.php
6
by: John | last post by:
Hi. I am having a few header problems at the moment with a login page. I don't have my headers at the top of the page where I've learned I need to have them. However, I also know I'm supposed...
3
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change...
9
by: bajopalabra | last post by:
hi session("myVar") = rs.getRows( ) don't work when number of records is greater than 10 does anybody know WHY ??? is it a Session object limitation ??? thanks
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
5
by: jb | last post by:
*Please* help --- I'm tearing my hair out. I want to use sessionstate in a webservice, accessed from a client, written in script (JScript, InfoPath). I have written my webservice (C# .NET). I...
23
by: lwoods | last post by:
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target...
2
by: Gurunadh | last post by:
Hi i've some web user controls in one folder and web pages in some other folder. and i've included header web user control in all my web pages. and in that user control wrote code to get the...
0
by: Aarchaic | last post by:
Hello i have problem my session variables seem to disapear as i go along i've created this code to ilustrate whats happening First off i just post 3 detials like a name a age and a favourite...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.