我对PHP完全不熟悉,但设法有一个功能,允许我上传图像作为博客条目的一部分。问题是我试图让这也允许视频上传。我已经尝试了一切,但仍然无法理解它。这是我现在的代码,任何帮助将不胜感激
<form method="post" enctype="multipart/form-data">
<div class="card m-b-20">
<div class="card-block">
<div class="m-t-20">
<h6 class="text-muted"><b>Title</b></h6>
<input type="text" name="title" class="form-control" />
</di>
<div class="m-t-20">
<h6 class="text-muted"><b>Blog Image</b></h6>
<input type="file" name="file" class="form-control" />
</di>
<div class="m-t-20">
<h6 class="text-muted"><b>Content</b></h6>
<p class="text-muted m-b-15 font-13">
<textarea class="summernote" name="message"></textarea>
</div?
</div>
</div>
<input type="submit" name="btnsave" class="btn btn-primary btn-lg" value="Submit">
</form>
<?php
include_once '../config/dbConfig.php';
if(isset($_POST['btnsave']))
{
$title = $db->real_escape_string($_POST['title']);
$info = $db->real_escape_string($_POST['message']);
$slug = wordwrap(strtolower($title), 1, '-', 0);
date_default_timezone_set("Africa/Lagos");
$d=date('Y-m-d');
$file_size = $_FILES['file']['size'];
$file_type = $_FILES['file']['type'];
$folder="../assets/img/slider/";
$temp = explode(".", $_FILES["file"]["name"]);
$pix = $d . '_' . rand(1000,100000). '.' . end($temp);
$target_file = $folder . $pix;
$query = $db->query("INSERT INTO blog (`title`, `slug`, `content`, `image`, `date`) VALUES ('$title', '$slug', '$info', '$pix', '$d')");
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
if (isset($query_new_m)){
?>