时间:2021-07-01 10:21:17 帮助过:1人阅读
html
php
// upload_file.php 0) { // echo "Return Code: " . $_FILES["file"]["error"] . "
"; } else { echo "Upload: " . $_FILES["file"]["name"] . "
"; echo "Type: " . $_FILES["file"]["type"] . "
"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
"; if (file_exists($DIR . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; header('Location: http://59.78.7.9/index.html'); } else { move_uploaded_file($_FILES["file"]["tmp_name"], $DIR. $_FILES["file"]["name"]); echo "Stored in: " . $DIR . $_FILES["file"]["name"]; header('Location: http://59.78.7.9/index.html'); } } } else { echo "Invalid file, you can't upload files of ".$postfix; } ?>
ipad的safari或chrome都是这样的问题。
html
php
// upload_file.php 0) { // echo "Return Code: " . $_FILES["file"]["error"] . "
"; } else { echo "Upload: " . $_FILES["file"]["name"] . "
"; echo "Type: " . $_FILES["file"]["type"] . "
"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb
"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
"; if (file_exists($DIR . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; header('Location: http://59.78.7.9/index.html'); } else { move_uploaded_file($_FILES["file"]["tmp_name"], $DIR. $_FILES["file"]["name"]); echo "Stored in: " . $DIR . $_FILES["file"]["name"]; header('Location: http://59.78.7.9/index.html'); } } } else { echo "Invalid file, you can't upload files of ".$postfix; } ?>
exif_imagetype()
函数检查实际文件头。
请问这个问题怎么解决的?我是苹果手机上传图片名称默认就改成了image.jpg. 我们用的是HTML5.安卓和浏览器上传都正常。