0

I search how i upload videos into my database and i found this code and is get me this error

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

I Change the php.ini upload_max_filesize=25M

In my database my link is varchar(255)

The folder name is videos and the path is correct

<?php

    error_reporting(1);


    $server = "localhost";
    $user_name = "root";
    $password = "";
    $dbname = "rossidb";

    // Create connection
    $conn = mysqli_connect($server, $user_name, $password, $dbname);
    $db_found = mysqli_select_db($conn,"rossidb");

    extract($_POST);

    $target_dir = "../../videos/";

    $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

    if($upd)
    {
    $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);

    if($imageFileType != "mp4" && $imageFileType != "avi" && $imageFileType != "mov" && $imageFileType != "3gp" && $imageFileType != "mpeg")
    {
        echo "File Format Not Suppoted";
    } 

    else
    {

    $video_path=$_FILES['fileToUpload']['name'];

    mysqli_query( $conn, "insert into videos(link) values('$video_path')");

    move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$target_file);

    echo "uploaded ";

    }

    }

    //display all uploaded video

    if($disp)

    {

    $query=mysqli_query($conn,"Select * from videos");

        while($all_video=mysqli_fetch_array($query))

        {
?>

     <video width="300" height="200" controls>
    <source src="../../videos/<?php echo $all_video['link']; ?>" type="video/mp4">
    </video> 

    <?php } } ?>


<form method="post" enctype="multipart/form-data">

<table border="1">

<tr>

<Td>Upload  Video</td></tr>

<Tr><td><input type="file" name="fileToUpload"/></td></tr>

<tr><td>

<input type="submit" value="Uplaod Video" name="upd"/>

<input type="submit" value="Display Video" name="disp"/>

</td></tr>

</table>

</form> 
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345

0 Answers0