【发布时间】:2015-10-12 18:55:22
【问题描述】:
我是 PHP 新手。我正在尝试使用 php 上传图片。但它不起作用。请帮忙。提前致谢
<?php
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
?>
<form action="upload.php" method="post" >
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
【问题讨论】:
-
“它不工作”是什么意思?一个错误?你检查过日志文件吗?
-
您可以通过轻松上传图片
标签: php