这是我的HTML
<div style = "margin-left: 10px">
<img id = "prev"src="defaultimg.jpg" alt="Default Profile Pic" width="220" height = "220">
<input style="margin-top:10px;" value = "xxxx" id = "newphoto" type="file" name = "myimg">
并且继续我的PHP。
$photox = $_POST['photo'];
$target = '/images/';
$photo = $target . basename($_FILES['myimg']['name']);
move_uploaded_file($_FILES['myimg']['tmp_name'], $photo);
发生错误,未定义的变量&#34; mying&#34;。 。请帮忙
答案 0 :(得分:0)
您可以使用JS formdata https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects
并执行AJAX