Home >Backend Development >PHP Tutorial >php-multipart/form-data上传图片 解析为空

php-multipart/form-data上传图片 解析为空

WBOY
WBOYOriginal
2016-06-02 11:28:441791browse

phphtml

如题 提交格式如下
Content-type: multipart/form-data, boundary=aaaaa

--aaaaa
content-disposition: form-data; name="name"

aaaa
--aaaaa
content-disposition: form-data; name="image"; filename="image.png"
Content-Type: image/png

// 这里是关于图片的解码
--aaaaa--

PHP进行解析
$newfilename = "photo/".$_POST['name']."/".$_FILES["image"]["name"];
echo $newfilename;
if(move_uploaded_file($_FILES["image"]["tmp_name"], $newfilename))
{
echo "上传成功!
";
}
打印结果:photo//
name和图片信息都没有获取到 求帮助....
如果我写的不对,应该怎么写呢?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn