[PHP] header problem for mobile browser

2004-10-19 Thread QT
Hi,

I want to make a php file for download a jad file. I am using following
script to let browser understand that jad file is coming and download it.

But I have very interesting problem. If user open browser and write correct
addres following script let the download file.

But if the user open browser and write wrong addres and get some error.
After write correct address, still getting same error.

I think following script can not reset the previos header and browser still
using previous header and bring back an error.

What should I do, for this problem, any idea

$SRC_FILE = $file;
 $download_size = filesize($SRC_FILE);
 $filename = basename($SRC_FILE);
 header(Content-Type: text/vnd.sun.j2me.app-descriptor);
 header(Content-Disposition: attachment; filename=$filename);
 header(Accept-Ranges: bytes);
 header(Content-Length: $download_size);
 @readfile($SRC_FILE);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] header problem for mobile browser

2004-10-19 Thread raditha dissanayake
QT wrote:
Hi,
I want to make a php file for download a jad file. I am using following
script to let browser understand that jad file is coming and download it.
 

Not sure If I have understood your question correctly but surely it 
would be easier for you to just add the following lines to your 
.htaccess file  and give a direct download link instead of trying to 
deliver through a php script.

addtype application/java-archive jar
addtype text/vnd.sun.j2me.app-descriptor jad
if you do deliver through a php script, the phone will follow up with a 
request for the jar file when it has recieved the jad file, your script 
needs to be able to handle that as well.

But I have very interesting problem. If user open browser and write correct
addres following script let the download file.
But if the user open browser and write wrong addres and get some error.
After write correct address, still getting same error.
I think following script can not reset the previos header and browser still
using previous header and bring back an error.
 

you cannot reset headers once they have been sent.  The headers you use 
seem ok but i would add a no-cache header as well.

header('Pragma: no-cache');
What should I do, for this problem, any idea
$SRC_FILE = $file;
$download_size = filesize($SRC_FILE);
$filename = basename($SRC_FILE);
header(Content-Type: text/vnd.sun.j2me.app-descriptor);
header(Content-Disposition: attachment; filename=$filename);
header(Accept-Ranges: bytes);
header(Content-Length: $download_size);
@readfile($SRC_FILE);
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php