ID: 26326
Updated by: [EMAIL PROTECTED]
Reported By: jnixon at postregister dot com
-Status: Open
+Status: Feedback
Bug Type: Apache2 related
Operating System: Linux
PHP Version: 4.3.3
New Comment:
Replace that script with this:
<?php
var_dump($_FILES);
?>
And post the output here (when you upload the problem file to it)
Previous Comments:
------------------------------------------------------------------------
[2003-11-19 18:54:38] jnixon at postregister dot com
if ($_POST["MAX_FILE_SIZE"] != "")
{
$error = "";
if ($_FILES['userfile']['name'] == "")
{
$error = "Please choose an image.";
}
elseif ($_FILES['userfile']['size'] > $_POST["MAX_FILE_SIZE"])
{
$error = "Image is to large, the image must be less
then 5MB";
}
elseif ($_FILES['userfile']['type'] == "image/jpeg")
{
$uploaddir = '/var/www/postregister/ad/classadimages/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'],
$uploadfile)) {
$fileUpload = 1;
$mySql = "Select * from Classifieds.UpLoadImages
where
SessionID = '" . $sessId . "' and ImageName = '" .
$_FILES['userfile']['name'] . "'";
//echo $mySql . "<br>";
$myResult = mysql_query($mySql) or
die("UpLoadImages Select:
Invalid query: " . mysql_error());
$myCount = mysql_num_rows($myResult);
if ($myCount == 0)
{
$mySql = "Insert into
Classifieds.UpLoadImages
(SessionID,ImageName) values ('". $sessId . "','" .
$_FILES['userfile']['name'] ."')";
//echo $mySql . "<br>";
mysql_query($mySql) or die("Sub Cat
Invalid query: " .
mysql_error());
}
} else {
$fileUpload = 0;
}
}
else
{
$error = "Image must be a JPEG, ie: imagename.jpg";
}
}
------------------------------------------------------------------------
[2003-11-19 18:38:22] [EMAIL PROTECTED]
And what exactly do you have in the extra.php script??
------------------------------------------------------------------------
[2003-11-19 18:35:24] jnixon at postregister dot com
Description:
------------
I'm new at sending out these things, so please be patient.
The problem I am having is with the file upload in apache 2.0.45, and
mod_php 4.3.3
Works fine under *nix, it is the Microsoft Windows people I'm having
the
problems with.
I bereave it has to do with the spaces in the name.
If the name of the file has no spaces, than the location must not have
any spaces.
If the name of the file has a space or more in the name then the
location
doesn't matter.
Examples:
Does not work: C:\Documents and Settings\username\Desktop\image.jpg
Works: C:\Documents and Settings\username\Desktop\image name.jpg
Works: C:\image name.jpg
Works: C:\image.jpg
Works: C:\images\imagename.jpg
I'm tying to upload a file using.
<form ENCTYPE="multipart/form-data" action="extra.php" method="POST">
Upload an image: <input name="userfile" type="file" size="100">
<input type="submit" value="Send File">
</form>
If the file looks like this:
C:\Documents and Settings\username\Desktop\image.jpg
I have submited an bug report with apache and they said it was not a
problem with apache.
Reproduce code:
---------------
<form ENCTYPE="multipart/form-data" action="extra.php" method="POST">
Upload an image: <input name="userfile" type="file" size="100">
<input type="submit" value="Send File">
</form>
Expected result:
----------------
Netscape gives an error of "The document contains no data".
In IE I get the page cannot be displayed error.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26326&edit=1