I have the following:
<?php
if(isset($_POST['upload']) && $_FILES['result']['size'] > 0)
{
$fileName1 = $_FILES['result']['name'];
$tmpName1 = $_FILES['result']['tmp_name'];
$fileSize1 = $_FILES['result']['size'];
$fileType1 = $_FILES['result']['type'];
}
$fp = fopen($tmpName1, 'r');
$content = fread($fp, filesize($tmpName1));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{ $fileName1 = addslashes($fileName1);
}
$user =& JFactory::getUser();
$userid = $user->get('id');
$database =& JFactory::getDBO();
$testquery = "INSERT INTO jos_uploads (userid, name, type, size, content) " .
"VALUES ('$userid', '$fileName1', '$fileType1', '$fileSize1', '$content')";
$database->setQuery($testquery);
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
The problem is the uploaded file 's size is 0 kb. I am using windows xp. What's wrong? I had it worked on another machine.