上传图片时不使用表单或" enctype"

时间:2015-08-13 05:58:12

标签: javascript php

这是我的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;。 。请帮忙

1 个答案:

答案 0 :(得分:0)