鍍金池/ 問答/PHP/ 一次上傳有辦法傳兩張圖片嗎?

一次上傳有辦法傳兩張圖片嗎?

假設(shè)在一個表單中上傳圖片
如何分成兩張?

$target_dir = "../../images/user/cover/";
        $target_file = $target_dir . basename($_FILES["myFile_cover"]["name"]);
        $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
        $imagename = "chatgether_".$_SESSION['user'] . '.' . $imageFileType;
        $destination = $target_dir . $imagename;

        if(move_uploaded_file($_FILES["myFile_cover"]["tmp_name"], $destination))
        {
          
        }

同一張照片但是複製成兩張照片
A照片到A文件夾
B照片到B文件夾
如何上傳一次但卻有兩張照片?

回答
編輯回答
涼薄

move_uploaded_file之后
再用copy復(fù)制本地圖片到另一個文件夾就可以了

2018年6月24日 20:47