【发布时间】:2018-01-11 22:31:54
【问题描述】:
我正在尝试创建一个网页以从 iPhone 的照片库上传图像或使用 iPhone 的相机拍摄图像。
This is the error message on my iphone
这是上传图片的html代码
<html>
<form action="test_upload_image_results.php" method="post" enctype="multipart/form-data">
Select image to upload:
<br><input type="file" name="imageUpload" id="imageUpload">
<br><br><input type="submit" value="Upload Image" name="submit">
</form>
</html>
这是用于上传图片的php代码(test_upload_image_results.php)
<html>
<body>
<?php
print_r($_FILES);
$tmpName = $_FILES["imageUpload"]["tmp_name"];
$destDir = "uploads/";
if (!is_dir($destDir))
{
throw new Exception('Destination is not a directory.');
}
if (!is_writable($destDir))
{
throw new Exception('Destination directory is not writable.');
}
$destination = $destDir.basename($_FILES["imageUpload"]["name"]);
if (is_file($destination))
{
throw new Exception('Destination filename already exists.');
}
if (move_uploaded_file($tmpName, $destination))
{
echo "done";
}
else
{
throw new Exception('Unable to move file.');
}
?>
</body>
</html>
抱歉,这是一个非常初级的问题。
【问题讨论】:
-
UPLOAD_ERR_INI_SIZE 值:1;上传的文件超过了 php.ini 中的 upload_max_filesize 指令。
标签: php iphone file-upload