Hi All,
Am having troubles posting a filename in firefox 1.0. It seems my
variable (which contains a slash) is truncated but only in firefox.
I'm running apache & php4.3.9 on windows XP. magic_quotes_gp c is off
and I've been googling around for half a day without any luck. The
code is below:
<?php
$strDesc = $_REQUEST['strDesc'];
$fileUpload = $_REQUEST['fileUpload'];
$fileUpload_typ e;
if(empty($strDe sc) || $fileUpload == "none")
die("You must enter both a description and file");
// Database connection variables
$dbServer = "localhost" ;
$dbDatabase = "file_repositor y";
$dbUser = "root";
$dbPass = "";
$fileContent = implode('', file($fileUploa d));
$fileContent = addslashes($fil eContent);
$sConn = mysql_connect($ dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db ($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO myTexts VALUES ";
$dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_ty pe')";
mysql_query($db Query) or die("Couldn't add file to database");
echo var_dump($fileU pload);
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>" ;
echo "<b>File name:</b> $fileUpload_nam e <br>";
echo "<b>Uploade d to:</b> $fileUpload <br><br>";
echo "<a href='uploadfil e.php'>Add Another File</a>";
?>
I've tested this in ie and opera and it works in both however firefox
does something funny. If I specify fileUpload as "C:\Document1.t xt" on
the previous page, var_dump() then shows that $fileUpload is a
string(16) in opera and ie but only a string(13) in firefox
(specifically, firefox sees "Document1.txt" ). I've taken most of this
from a tutorial located at:
Any help appreciated,
Thankyou.
Cameron
Am having troubles posting a filename in firefox 1.0. It seems my
variable (which contains a slash) is truncated but only in firefox.
I'm running apache & php4.3.9 on windows XP. magic_quotes_gp c is off
and I've been googling around for half a day without any luck. The
code is below:
<?php
$strDesc = $_REQUEST['strDesc'];
$fileUpload = $_REQUEST['fileUpload'];
$fileUpload_typ e;
if(empty($strDe sc) || $fileUpload == "none")
die("You must enter both a description and file");
// Database connection variables
$dbServer = "localhost" ;
$dbDatabase = "file_repositor y";
$dbUser = "root";
$dbPass = "";
$fileContent = implode('', file($fileUploa d));
$fileContent = addslashes($fil eContent);
$sConn = mysql_connect($ dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db ($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO myTexts VALUES ";
$dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_ty pe')";
mysql_query($db Query) or die("Couldn't add file to database");
echo var_dump($fileU pload);
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>" ;
echo "<b>File name:</b> $fileUpload_nam e <br>";
echo "<b>Uploade d to:</b> $fileUpload <br><br>";
echo "<a href='uploadfil e.php'>Add Another File</a>";
?>
I've tested this in ie and opera and it works in both however firefox
does something funny. If I specify fileUpload as "C:\Document1.t xt" on
the previous page, var_dump() then shows that $fileUpload is a
string(16) in opera and ie but only a string(13) in firefox
(specifically, firefox sees "Document1.txt" ). I've taken most of this
from a tutorial located at:
Any help appreciated,
Thankyou.
Cameron
Comment