<?
$uploadDir = 'media/';
if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
  // the files will be saved in filePath
$filePath = $uploadDir . $fileName;

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

$username="";
$password="";
$database="";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

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

mysql_query($query) or die('Error, query failed : ' . mysql_error());

include 'library/closedb.php';

echo "<br>File uploaded<br>";
}
?>


On 11/18/05, Bastien Koert <[EMAIL PROTECTED]> wrote:
>
> show code, maybe checks are being done to only allow images or certain
> extensions...
>
>
> Bastien
>
>
> >From: Mohamed Yusuf <[EMAIL PROTECTED]>
> >To: php-db@lists.php.net
> >Subject: [PHP-DB] Can't Upload ram file
> >Date: Fri, 18 Nov 2005 06:19:24 -0800
> >
> >the script I am using can upload images like, jpg, gif or png to the
> >server,
> >but it can't upload music file to the server like ram and rm.
> >any help?
>
>
>

Reply via email to