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>";    
                 
 ?>

Did you check if the filesize does not exceed the max upload limit ?

if upload a pdf file of size 326 KB then it is uploading but if i upload 2036 kb then it is not uploading.

i am unable to upload the files which are above 1000 kb

You can change it in the php configuration file or in the htaccess file, whichever your host allows.

Create a .htaccess file in the root folder of web server
Put the following code in the .htaccess file and save it.

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200

Now you can upload of up-to 20MB

wer should i write this code.can u please say me.

Open notepad, paste the code in, click save with the name .htaccess
Upload it to your website root folder (www or public_html)

Test your upload thingy and see what happens.

ya i had done in that way but i didnt get that. I am unable to upload files with size more than 2 MB

Chat to your host, make sure they allow htaccess.

actually i am trying in localhost. so hw can i.

On localhost? IIS, WAMP or the like?
On WAMP it's the rewrite module, on IIS - no clue.

Basically, that code should work online.

may i send u a private message of my php.ini . so can u modify the necessary changes init.

Sure where do I find the private messages?

Change this in your php.ini

post_max_size = 16M
upload_max_filesize = 20M

Restart your PC/Server and you're set.

hey tats great man...!!! Thank u i got it. wat the thing is after these changes we should restart server or PC.
Thanks again..

You got it working?
Bonus!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.