Hi Everyone...got one problem but couldn't solve it due to my lack of knowledge of the server stuffs. Hope someone can answer my question .. First, take a look at my download script, which works.
<?php
header ("Content-Type: audio/midi");
header ("Content-Disposition: attachment; filename='/midi/100050.mid'");
header ("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize("/midi/100050.mid"));
readfile("/midi/100050.mid");
?>
The problem is, what is the difference between reading and outputing a file in this way, that user clicking on a hyperlink pointing directly to the file?
You may wonder what matters does this concern, actually, i am writing a script to return this file to the user handphone, and to mask the url so the user will not be able to see the full path. Problem is, there is a bug with Sony Ericsson phone, if you return a file which is bigger than 10kb like what i did, it will failed definately. to make thing worst, even if you do a redirection to the actual file itself(without going thru this script above), it still fails, but work okay with file less than 10k. The only way to solve this, if to have a page, and on that page, put a hyperlink and point directly to the actual file. This works, but it defeats the whole purpose of masking the full path.
And so, my question is, when user click on the link which link direct to the file, what does the server return? Because Sony Ericsson Phone seems to be able to differentiate file which is return from my script or a file with a full path supplied by displaying a different screen for download.
Now my thought is, how do i fool the phone to think that what my script return is the same as what is being return when the user click the link?
I am desperately need of suggestion cos this has bug me for months.. 🙁 You are welcome to share anything you think of.
Thanks.