Avatar of Frontstart
Frontstart

asked on 

Video Size is limited

I have put a video uploader on my site and it is set to limit videos at 62MB as below.  However, I can upload videos at any size except videos over 8 MB.  What is limiting the size of the video to be uploaded? Is it the server?


$type = explode('.',$_FILES["file"]["name"]);
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
if ((( end($type) == "mpg")
|| (end($type) == "MPG")
|| (end($type) == "mpeg")
|| (end($type) == "MPEG")
|| (end($type) == "wmv")
|| (end($type) == "WMV"))
AND ($_FILES["file"]["size"] < 62000000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
  //  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  //  echo "Type: " . end($type) . "<br />";
  //  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  //  echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

   
      $new_name = time().rand(1,9999999).".".end($type);
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $new_name);
     
      //echo "Stored in: " . "upload/" . $new_name;
       $inserted= "INSERT INTO `ajax_chat_video` (id, filename, title, career, student ) VALUES (
       NULL,
       '".$new_name."',
       '".$_POST[video_title]."',
       '".$_POST[video_career]."',
       '".$_SESSION[id]."'
        )";
      // echo $inserted;
       $just = explode('.',$new_name);
       $sql = @mysql_query($inserted);
       $location = "/home/front/www/chat/upload/";  
       //$location = "upload/";  
       $command = "/usr/local/bin/ffmpeg -i ".$location.$new_name." -deinterlace -ar 44100 -r 25 -qmin 7 -qmax 9 ".$location.$just[0].".flv";
      //     $ffmpeg = exec($command);

$last_line = system($command , $retval);
       
       //echo $last_line.'<br/><br/>'.$retval.'<br/><br/>'.$command.'<br/><br/>';
       
      // $command = "ls -lh";
      // echo exec($command);
       //$command = "ffmpeg -i ".$location.$new_name." -r 1  -t 00:00:10 -f image2 ".$location.$just[0].".png";;
       $command = "/usr/local/bin/ffmpeg -i ".$location.$new_name." -an -ss 00:00:03 -an -r 1 -vframes 1 -y ".$location.$just[0]."%d.jpg";
       $ffmpeg = exec($command);
       
           
       //echo '<br/>'.$command.'<br/>';
       //echo '<br/>'.$ffmpeg.'<br/>';
      echo "The file has been uploaded!";
      }
   
  }else{
  echo "Invalid file, please try again. Type: ".end($type)." | Size: ".$_FILES["file"]["size"];
  }


//echo 'OK OK OK OK OK OK OK OK OK OK ';


?>
</body>
</html>
Web BrowsersPHPMySQL Server

Avatar of undefined
Last Comment
Frosty555
ASKER CERTIFIED SOLUTION
Avatar of Frosty555
Frosty555
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Frosty555
Frosty555
Flag of Canada image

Other things that can cause a large file upload to fail is the IIS/Apache server directly limiting the size of a request header, and also if the script times out before all the data can be uploaded this can also interrupt a file upload and not let it complete.

http://www.radinks.com/upload/config.php

Lots of good info on the subject in the link above.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo