Page 1 of 1
Netscape redirect problem (Solved!!!!!)
Posted: Tue Apr 06, 2004 9:55 pm
by Chris Corbyn
How come internet explorer understands how to handle this redirect using the header function but netscape doesn't? This same code works in netscape if redirecting to a midi file so why not a .mmf file??????
Problem: Trys to save the file as filename.mmf.php
Result: Even if once downloaded the file is renamed properly it doesn't open because it is an empty file
Code: Select all
header ('Content-type: Application/MMF');
header ('Content-Disposition: attachment;
filename="'.$_POST['filename'].'.mmf"');
readfile (''.$sam16string.$_POST['filename'].'.mmf');
Posted: Wed Apr 07, 2004 8:00 am
by TheBentinel.com
Are the headers case-sensitive? Maybe try "application/mmf" instead of "Application/MMF".
Here's a discussion of the same problem:
http://www.phpbuilder.com/board/showthr ... genumber=1
Posted: Wed Apr 07, 2004 8:39 am
by Chris Corbyn
Looked at that other post...
Seems nobody will ever suss this one out.
I considered contactiing netscape themselves to ask about this but I begrudge paying 9.95 for the privilige. LOL
Posted: Fri Apr 09, 2004 1:48 pm
by Chris Corbyn
Just a quick update. Problem solved! It wasn't an obvious problem neither does it make any sense but here's what it was.
I know many people have struggled with this same problem so you can all now go and make it work....
My header commands were in a file called download.php this took the filename from a POST command in a form and redirected to it.
All I had to do was put a '/' after the the download.php url.
For example where I used to have this:
Code: Select all
echo '<form action="download.php" method="post">';
echo '<input type="text" name="auth">';
/*Link information and image name are posted in form*/
echo "<input type='hidden' value='" . htmlspecialchars($ImgArray[0]) . "' name='code' />\n";
echo "<input type='hidden' value='" . htmlspecialchars($_GET['maintype']) . "' name='maintype' />\n";
echo "<input type='hidden' value='" . htmlspecialchars($_GET['n']) . "' name='filename' />\n";
echo '<p>';
echo '<input type="submit" name="submit" value="Download">';
echo '</form>';
I've now got this:
Code: Select all
echo '<form action="download.php/" method="post">';
echo '<input type="text" name="auth">';
/*Link information and image name are posted in form*/
echo "<input type='hidden' value='" . htmlspecialchars($ImgArray[0]) . "' name='code' />\n";
echo "<input type='hidden' value='" . htmlspecialchars($_GET['maintype']) . "' name='maintype' />\n";
echo "<input type='hidden' value='" . htmlspecialchars($_GET['n']) . "' name='filename' />\n";
echo '<p>';
echo '<input type="submit" name="submit" value="Download">';
echo '</form>';
Notice the change in the <form action= > tag?. It's a sure fix. You need to use application/octet-stream as usual in the header function on the download.php page too.
Good Luck guys!