WebImage.GetImageFromRequest
即使有文件,我也会返回 null。怎么会这样?
cshtml代码:
@{
if(IsPost)
{
if(Request["upload"] != null)
{
image = WebImage.GetImageFromRequest();
if(image != null)
{
// something
}
}
if(Request["btn"] != null)
{
// something
}
}
}
<form action="" method="post">
<table>
<tr>
<td>
<p>
Upload image:
</p>
</td>
<td>
<input type="file" name="img" />
<br/>
<input type="submit" name="upload" value="Upload" />
</td>
</tr>
</table>
<input type="submit" name="btn" value="update" />
</form>