Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Forum » x-Forum » Question

how to set limit for video file size upload

Hi, i have a webapp that allows users to upload video to server for sharing, but inorder to minimize storage usage i want to set a limi to video file size upload per user.
But when i added a code snippet for the modification after saving and refreshing the page it goes blank i.e it does not show anything on the UI for uploading.
See the code below

if ($_POST['video_type']=='local')

              $maxsize = 5242880; // 5MB
              // Check file size
            if(($_FILES['file']['size'] >= $maxsize) || ($_FILES["file"]["size"] == 0)) {
            echo "File too large. File must be less than 5MB.";
            // Upload
            $file_path = 'http://'.$_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']).'/uploads/';
              echo "Upload successfully.";
           /*   $file_path = 'http://'.$_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']).'/uploads/';   */

              $file_name= str_replace(" ","-",$_FILES['video_thumbnail']['name']);

              //Main Image
              $pic1=compress_image($_FILES["video_thumbnail"]["tmp_name"], $tpath1, 80);
              //Thumb Image 


Kindly help		

Posted by joakins 2019-04-12 10:48:28

No Ans Posted

Please login to comment

Log In

Ask New Question