Apabila gambar dimuat naik ke folder, nama fail menjadi bercelaru.
主持人~冬旭
主持人~冬旭 2019-11-27 13:10:04
0
1
1260

<?phpif (count($_FILES)) { $retFiles = uploadFile("file"); if ($retFiles['status'] == 1) { echo $retFiles['message']; } else if ($retFiles['status'] == 0) { echo "Muat naik: " . $retFiles["nama"] . "<br />"; echo "Jenis: " . $retFiles["type"] . "<br />"; echo "Saiz: " . ($retFiles["saiz"] / 1024) . " Kb<br />"; echo "Fail temp: " . $retFiles["temp"] . "<br />"; echo "Disimpan dalam: " . "muat naik/" . $retFiles["nama"]; }}function uploadFile($fileName){ $files = $_FILES[$fileName]; if (!in_array($files["type"], array("image/gif","image/jpeg","image/pjpeg","image/jpeg", "image/png"))) { return array ("status" => 1, "message" => "Format imej yang dimuat naik tidak betul"); }  jika ($files["error"] > 0) { return array("status" => 1, "message" => "ralat muat naik"); } if (file_exists("upload/" . $files["name"])) { return array("status" => 1, "message" => $files["name"]." already exists") ; } move_uploaded_file($files["tmp_name"], "upload/".$files["name"]); return array("status" => 0, "name" => $files["name"], "type" => $files["type"], "size" => $files['size ']/1024, "temp" => $files["tmp_name"]);}?>就是这段代码

主持人~冬旭
主持人~冬旭

membalas semua(1)
A峰

Tetapkan pengekodan aksara dan lihat: header("Content-type:text/html;charset=utf-8");

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan