Jump to content


Photo

file uploads


  • Please log in to reply
No replies to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 03 May 2006 - 07:10 PM

i'm using this code to upload files to my database and a directory.. bu the problem is that once is uploaded, the picture comes out as a FORBIDDEN view file..
<?php
$uploadDir = 'xml/';

if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];

$filePath = $uploadDir . $fileName;

$result = move_uploaded_file($tmpName, $filePath);
if (!$result) {
echo "Error uploading file";
exit;
}

include 'config/db.php';


if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
} 

$query = "INSERT INTO upload2 (name, size, type, path ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";

mysql_query($query) or die(mysql_error());


}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users