0

I need to upload a video file. Here's my code

 if(($_FILES["file"]["type"]=="application/octet-stream") || ($_FILES["file"]["type"]=="video/x-ms-wmv"))
          {
        if($_FILES["file"]["error"] > 0)
          {
          echo "Error: ".$_FILES["file"]["error"]."<br />";

          }
        else if(file_exists("videos/" . $_FILES["file"]["name"]))
              {
              echo $_FILES["file"]["name"] . " already exists. ";
              }
            else
              {
              move_uploaded_file($_FILES["file"]["tmp_name"],"videos/".$_FILES["file"]["name"]);

        $filename=$_FILES["file"]["name"];  
        $type=$_FILES["file"]["type"];
        $size=($_FILES["file"]["size"]/1024);
        $path="".$_FILES["file"]["name"];
       if(($ins=mysql_query("insert into achieva_video values('','".$_REQUEST['vname']."','".$_REQUEST['courid']."','".$filename."','".$path."','".$size."','".$type."','Active')"))==true)
        {
            header("location:viewcoursevideo.php?ins=1");
        }  
        else
        {
            echo("<script>alert('Failure Please try again later');</script>");
        }
     }
          }

    else
     {
      echo "<script>alert('Invalid File Type');</script>)";

     }

I'm bit confused with this warning message when I try to upload a video file.

"PHP Warning:  POST Content-Length of 9311816 bytes exceeds the limit of 8388608 bytes in Unknown on line 0"

I've set the following preferences in the php ini:

 memory limit = 150M
  upload file size = 120M 
  post max size = 120M

The file has not been updated. it takes long time and just shows this warning.

vyegorov
  • 21,787
  • 7
  • 59
  • 73
Raj
  • 943
  • 2
  • 10
  • 12

2 Answers2

0

the message seems clear: you have an upload limit set to 8M (8388608 bytes) and you are uploading a file of 9M (9311816 bytes). Are you really sure these settings in php.ini are working?

 memory limit = 150M
 upload file size = 120M 
 post max size = 120M
ab_dev86
  • 1,952
  • 16
  • 21
  • But i could see in the phpinfo the preferences set as above. How to check working or not? – Raj May 10 '12 at 09:58
  • Could it be that the problem is that you reach the max execution time for the php script? For examplet the uplaod is slow and it takes too much time. try to increase the value of max_execution_time ! – ab_dev86 May 10 '12 at 10:20
  • The max_execution_time is set to 3600s means 1hr. – Raj May 10 '12 at 10:38
0

Shouldn't it be like this? (underscores, max!)

memory_limit = 150M
upload_max_filesize = 120M
post_max_size = 120M
cypher
  • 6,822
  • 4
  • 31
  • 48