473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Truncated post in firefox

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:

<?php
$strDesc = $_REQUEST['strDesc'];
$fileUpload = $_REQUEST['fileUpload'];
$fileUpload_type;

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:
http://www.devarticles.com/c/a/MySQL...PHP-and-MySQL/
Any help appreciated,
Thankyou.
Cameron

Jul 17 '05 #1
4 2333
Cameron <fo*********@gmail.com> wrote:
$strDesc = $_REQUEST['strDesc'];
$fileUpload = $_REQUEST['fileUpload'];
$fileUpload_type;
[snip]
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:
http://www.devarticles.com/c/a/MySQL...PHP-and-MySQL/


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
(http://nl3.php.net/manual/en/features.file-upload.php explains how to
do that).

IMHO FireFox is correct, the server has no business knowing the path to
a file on a client.
Jul 17 '05 #2
Thanx sorting me out Daniel. Sorry, bit of a newbie

Jul 17 '05 #3
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.
hmmm...
either it doesn't matter now =)

Jul 17 '05 #4
I noticed that Message-ID:
<11*********************@f14g2000cwb.googlegroups. com> from Cameron
contained the following:
Thanx sorting me out Daniel. Sorry, bit of a newbie


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 http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: | last post by:
Hi everyone, I'm using VS.NET, Framework 1.1, Windows 2000 Server, IIS 5, all the latest patches are installed. Im having this wierd random problem, that I cannot reproduce but it happens...
5
by: z. f. | last post by:
hi, i have a vb.net web application and i make a request using internet explorer to an aspx page. the aspx page size if over 170KB, and the page in internet explorer looks truncated and in the...
1
by: Ian Lotinsky | last post by:
I had a really weird bug recently. I had a drop-down user control that would not fire the onselectedchange event server-side. After nearly twenty hours of debugging, I finally setup a local proxy...
4
by: R.Manikandan | last post by:
Hi In my code, one string variable is subjected to contain more amount of characters. If it cross certain limit, the string content in the varabile is automatically getting truncated and i am...
3
by: =?Utf-8?B?TGVvNTk1?= | last post by:
I have a page that creates dynamic hyperlinks for each recorded displayed. Many of the constructed URLs exceed 128 characters. Those that with greater than 128 are truncated for some reason unknown...
2
by: News | last post by:
Hi, I have this javascript: ================================================= function confirmAndSubmit(val) { var confMessage; confMessage="Your benefit selections are final and cannot be...
14
by: FMDeveloper | last post by:
Currently transitioning from a shared host to a dedicated server. The same code that works on the old server is not working on the dedicated server. It is a simple AJAX request like: <code>...
2
by: Logician | last post by:
I am looking for some help about the method below which partly works. The problem is that the data returned is truncated in that the returned data has missing bytes near the beginning of the data....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.