0
이미지가있는 양식을 게시했습니다. 그리고 제출 된 이미지를 스트림으로 변환하는 방법은 무엇입니까?
var image=Request.Files["hiddenUploadButton"];
지금 내가 스트림에 내 이미지를 변환 할 내 컨트롤러에이를 수신하는 단계를 포함한다. 그렇게하는 방법?
이미지가있는 양식을 게시했습니다. 그리고 제출 된 이미지를 스트림으로 변환하는 방법은 무엇입니까?
var image=Request.Files["hiddenUploadButton"];
지금 내가 스트림에 내 이미지를 변환 할 내 컨트롤러에이를 수신하는 단계를 포함한다. 그렇게하는 방법?
if you want to save file try following code snippet
HttpPostedFile file = Request.Files["myFile"];
//check file was submitted
if (file != null && file.ContentLength > 0)
{
string fname = Path.GetFileName(file.FileName);
file.SaveAs(Server.MapPath(Path.Combine("~/App_Data/", fname)));
}
,
HttpPostedFile file = Request.Files["myFile"];
var FileLen = file .ContentLength;
byte[] input = new byte[FileLen];
System.IO.Stream MyStream;
// Initialize the stream.
MyStream = file .InputStream;
// Read the file into the byte array.
MyStream.Read(input, 0, FileLen);