hi all,
i had a page where we can upload files.so when i upload pdf,wmv,win files, they are not uploading. but the rest like txt,doc,jpeg are uploading fine.
so i need pdf,wmv,win files also upload. so can any one please...
here is my upload code.
<?php
ob_start();
@session_start();
require_once ("check.php");
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory,$Remainingmemory,$result,$data3);
include 'connection.php';
$id=$_POST[f];
$filename=$_FILES['uploaded']['name'];
$s=($_FILES['uploaded']['size']);
$a= round($s/1024,2);
$size=round($s/1024,2)." kb";
$answer=$_SESSION[answer];
$usedmemory=$_POST['usedmemory'];
$allocatedmemory=$_POST['data1'];
$remainingmemory=$_SESSION['data3'];
$query="select filename from files where filename='$filename' and projectname='$_SESSION[answer]'";
mysql_error();
$result=mysql_query($query);
$count=mysql_num_rows($result);
if($count=='0')
{
if($a < $remainingmemory)
{
$sql="insert into files(filename,size,uploadedby,projectname) values ('$filename','$size','$_SESSION[username]','$_SESSION[answer]')";
mysql_error();
$result = mysql_query($sql);
$dirname=$_SESSION[username];
$sql2="select reportingto from users where username='$_SESSION[username]'";
mysql_error();
$result2 = mysql_query($sql2);
if (mysql_num_rows($result2) > 0)
{
while($row = mysql_fetch_row($result2))
{
$admin=$row[0];
}
}
$dir=$admin;
$projectname=$_SESSION[answer];
if(is_dir($dirname))
{
$target = "$dir/$projectname/$dirname/";
$target = $target . basename( $_FILES['uploaded']['name']);
$ok=1;
if ($ok==0)
{
echo "Sorry your file was not uploaded";
}
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "<strong style='color:green'>"."The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"."</strong>";
}
else
{
echo " ";
}
}
}
else
{
$path="$dir//$projectname//$dirname";
@mkdir($path,0777,true);
$target = "$dir/$projectname/$dirname/";
$target = $target . basename( $_FILES['uploaded']['name']);
$ok=1;
if ($ok==0)
{
echo "Sorry your file was not uploaded";
}
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "<strong style='color:green'>"."The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"."</strong>";
}
else
{
echo " ";
}
}
}
}
else
{
echo "<strong style='color:#FF3333'>"."<left><h1>Insufficient Memory.</h1></left>"."</strong>";
}
}
else
{
echo "<strong style='color:#FF3333'>"."<left><h1>File with this name exist.</h1></left>"."</strong>";
}
echo "<left> <br> <input type='button' value='back' onClick='history.go(-1)'></left>";
?>