Truncated post in firefox

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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_gpc is off
and I've been googling around for half a day without any luck.  The
code is below:

$strDesc = $_REQUEST['strDesc'];
$fileUpload = $_REQUEST['fileUpload'];

if(empty($strDesc) || $fileUpload == "none")
die("You must enter both a description and file");

// Database connection variables
$dbServer = "localhost";
$dbDatabase = "file_repository";
$dbUser = "root";
$dbPass = "";

$fileContent = implode('', file($fileUpload));
$fileContent = addslashes($fileContent);

$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_type')";
mysql_query($dbQuery) or die("Couldn't add file to database");
echo var_dump($fileUpload);
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>";
echo "<b>File name:</b> $fileUpload_name <br>";
echo "<b>Uploaded to:</b> $fileUpload <br><br>";
echo "<a href='uploadfile.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.txt" 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,

Re: Truncated post in firefox

Quoted text here. Click to load it


Quoted text here. Click to load it

What is the purpose of this script? AFAIK it's used to add a file
_on the server_ to the database. If you want to upload files from a
client this is not a correct script
( explains how to
do that).

IMHO FireFox is correct, the server has no business knowing the path to
a file on a client.

Re: Truncated post in firefox

Thanx sorting me out Daniel.  Sorry, bit of a newbie

Re: Truncated post in firefox

An interesting point however - if I copy & paste the URL out of ie the
script will work OR if I change "\" to "/" in the form, mozilla can
then see the file.
either it doesn't matter now =)

Re: Truncated post in firefox

I noticed that Message-ID:
contained the following:

Quoted text here. Click to load it

Also consider simply storing the path to the file in the database rather
than the file itself.  Many find that easier.

Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs /

Site Timeline