|
http://www.sufeinet.com/thread-9994-1-1.html
这是PHP代码
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
C#
string postfile = "C:\\Users\\admin\\Desktop\\POST.txt";
//创建Httphelper对象
http = new HttpHelper();
//创建Httphelper参数对象
item = new HttpItem()
{
URL = "http://localhost/1.php",//URL 必需项
Method = "post",//URL 可选项 默认为Get
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
PostDataType = PostDataType.FilePath,
Postdata = postfile
};
返回的是PHP各种错误 用html文件来提交正常
|
|