Hi all,
I'm migrating PHP code from a Linux slackware (PHP 3) box to a w2K (PHP 4.2.3) box. I have run across a problem on the W2k box which doesn't appear on the slackware box. I want to save some data to a disk file, then have the user click a link to upload the file to their computer. Here is a code fragment:
$fp = fopen ($fname, "w");
// mysql query, followed by several fputs to create the file
fputs ( $fp, $string1 );
fputs ( $fp, $string2 );
...
fclose ($fp);
echo ("<HTML><HEAD>");
echo ("<META HTTP EQUIV =' Refresh'CONTENT='0; URL=
$fname'>") ;
echo ("</HEAD>");
echo ("<Font Face=Verdana Size=2> File Created. <A
HREF=$fname>Click Here to Download</A><P> </HTML>");
On PHP 3, the output file was created and a Download File popup with a Save As button allowed the user to copy the output file to their computer. On Windows 2k with PHP4, the output file is created, but the data is also displayed on the browser, and the "File Created" link is not visible. No Download File popup appears. If I comment out the calls to fputs, then the Download File popup appears as expected and the html link is displayed (but obviously the output file is empty). I can't tell if this is a configuration problem, or if there is a bug with fopen/fputs. How can I make this work on a w2k platform?
Thanks,
Kim