0
private function _upload_video() {
    $prev_image = $this->input->post('prev_video');
    $image = $_FILES['video']['name'];
    $image_type = $_FILES['video']['type'];
    $return_image = '';

    if ($image != "") {
        if ($image_type == 'video/mp4') {
            $destination = 'assets/uploads/gallery/';
            $file_type = explode(".", $image);
            $extension = strtolower($file_type[count($file_type) - 1]);
            $image_path = $this->input->post('gallery_id').'-video-' . time() . '-sms.' . $extension;
            move_uploaded_file($_FILES['video']['tmp_name'], $destination . $image_path);

            // need to unlink previous image
            if ($prev_image != "") {
                if (file_exists($destination . $prev_image)) {
                    @unlink($destination . $prev_image);
                }
            }
            $return_image = $image_path;
        }
    } else {
        //echo "image empty";
        //exit;
        $return_image = $prev_image;
    }
    return $return_image;
}

我已经创建了这个功能来在我的项目中上传视频。在本地主机中,一切正常,但是当我将代码推送到实时服务器时,此代码不起作用。如果我回$_FILES['video']['type'];显这一行,它将在实时服务器中不返回任何内容,因此代码不会移动到 if 块。

但是只有在实时服务器中,我的本地主机服务器问题才能正常工作。

谁能指导我解决问题。

4

0 回答 0