1
我試圖使用PHP將圖像從一個文件夾複製到另一個文件夾。 圖像移動正常,但是當我打開圖像時,圖像未顯示。從一個文件夾複製到另一個文件夾時未顯示圖像
任何想法?
謝謝。
以下是我的代碼。
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'image_copy') {
$image = $_POST['image'];
//name of file to be copied
$img = $image;
//read the file
$fp = fopen('files/post/' . $img, 'r') or die("Could not contact $img3");
$page_contents = "";
$new_text = fread($fp, 100);
$page_contents = $new_text;
//This moves you from the current directory user to the images directory in the new user's directory
chdir("files/profile");
//name of your new file
$newfile = $image;
//create new file and write what you read from old file into it
$fd = fopen($newfile, 'w');
fwrite($fd, $page_contents);
//close the file
fclose($fd);
exit;
}
你可能會顯示''你正在使用的HTML代碼? – Abela
好吧,我會@Abela – sradha