如何将 PHP 照片上传 /images 转换为 PHP 视频上传 /videos?

How to convert the PHP Photo Upload /images for PHP video upload /videos?

我的 Php class 照片是:

class Photo extends Db_object{


    protected static $db_table = "photos";
    protected static $db_table_fields = array('photo_id', 'title', 'description', 'filename', 'type', 'size');
    public $photo_id;
    public $title;
    public $description;
    public $filename;
    public $type;
    public $size;


    public $tmp_path;
    public $upload_directory = "images";
    public $custom_errors = array();
    public $upload_errors_array = array(


    UPLOAD_ERR_OK => "There is no error",
    UPLOAD_ERR_INI_SIZE => "The uploaded file exceeds the upload_max_filesize",
    UPLOAD_ERR_FORM_SIZE => "The uploaded file exceeds the MAX_FILE_SIZE directive",
    UPLOAD_ERR_PARTIAL => "The uploaded file was only partially uploaded.",
    UPLOAD_ERR_NO_FILE => "No file was uploaded.",
    UPLOAD_ERR_NO_TMP_DIR => "Missing a temporary folder.",
    UPLOAD_ERR_NO_FILE => "Failed to write file to disk.",
    UPLOAD_ERR_EXTENSION => "A PHP extension stopped the file upload."
);

上传表格是

<form action="upload.php" enctype="multipart/form-data" method="post">
    <?php
    //check if there was an error and print out the error

    if(!empty($upload_errors)){
        echo $the_message;
    }
    ?>


    <input type="file" name="file_upload"><br>

    <input type="submit" name="submit">

</form>

所以我以前从未上传过视频并使用过 a 或其他任何标签。任何人都可以指出一个不是 javasript 和后端拖放视频文件的教程吗?专门上传了.avi、mp4等格式的文件?我意识到照片上传允许 gif 文件,因此可以工作,但我正在寻找一种 mvc 硬编码方法。

我不太明白你的逻辑,但如果你想上传视频并将你想要的信息保存在你的数据库中,你可以使用 javascript (Jquery) 中的一些库,例如:dropzone for upload (front-end side) and use the global variable $ _FILES (look this)提取你需要的信息!