首页 > 解决方案 > 如何上传已经上传的文件

问题描述

服务器文件夹中有文件,我需要上传到其他文件夹中。它确实尝试过,但即使我无法从服务器中选择文件。没有 HTML。

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
?>

标签: php

解决方案


您无法从服务器上传文件。所以需要将一个文件夹复制到另一个文件夹。谢谢你。

copy(file,to_file)

推荐阅读