Home > Net >  Upload pictures and encounter the webp oFile. InputStream hint parameter error, strives for the big
Upload pictures and encounter the webp oFile. InputStream hint parameter error, strives for the big

Time:07-15


The HttpPostedFile oFile;
System. Drawing. The Image originalImage;

The HttpPostedFile file & # 61; System. Web. HttpContext. Current. Request. Files [0].
For (int I & # 61; 0; I & lt; HttpContext. Current. Request. Files. Count; I & # 43; & # 43)
{
Try
{
oFile & # 61; HttpContext. Current. Request. Files [I];

//upload the artwork of

originalImage & # 61; System. Drawing. Image. FromStream (oFile InputStream);

string strext & # 61; Path. GetExtension (oFile. The FileName). ToLower ();

//string strext & # 61; Path. GetExtension (oFile. The FileName). ToLower ();
If (strext! The & # 61; & # 34; .gif & # 34; & & Strext! The & # 61; & # 34; .jpg & # 34; & & Strext! The & # 61; & # 34; The jpeg & # 34; & & Strext! The & # 61; & # 34; . PNG & # 34; & & Strext! The & # 61; & # 34; . Webp & # 34;)
{
Response. Write (& # 34; Wrong format: & # 34; & # 43; Strext);
return;
}
If (oFile ContentLength & gt; 10485760)
{
Response. Write (& # 34; More than 10 m & # xff01; & # 34;);
return;
}

  •  Tags:  
  • Related