Erro将视频上传到我的数据库

时间:2016-07-05 12:46:09

标签: php database video

我搜索我如何将视频上传到我的数据库,我找到了这个代码并且给我发现了这个错误

警告:POST内容长度12319290字节超过第0行未知的8388608字节限制

我更改php.ini upload_max_filesize = 25M

在我的数据库中,我的链接是varchar(255)

文件夹名称是视频,路径正确

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

0 个答案:

没有答案