我想将img从我的计算机上传到我的网站。当我单击输入类型“文件”时,我可以添加img并看到其名称。但是当我点击上传“请添加图片”显示时。
if (!empty($_POST["uploadImg"])) {
echo "button was clicked! "
if (!empty($_FILES['profileImg']['name'])) {
echo "it works!!!";
} else {
echo "please add image";
}}
HTML:
<form method="post" action="" class="edit_profile">
<!-- profielfoto -->
<img src="<?php echo "none"; //$profile[1]['image_name']
?>" alt="Profielfoto">
<input type="file" name="profileImg" id="profileImg" class="new_avatar" accept="image/gif, image/jpeg, image/png, image/jpg">
<!--button-->
<input type="submit" name="uploadImg" class="btn" value="Upload Image">
答案 0 :(得分:0)
尝试更改
prefix
到
<form method="post" action="" class="edit_profile">