1
나는 C# .net Compact Framework 3.5를 사용하고 있으며 비디오 파일을 바이트 배열로 변환하여 서버에 업로드 할 수 있습니다. 내가 성공 결과를 얻고 이미지 업로드를하고있는 중이 야 유사한 방법으로C#에서 비디오를 바이트 배열로 변환하는 방법 (c sharp)?
....
HttpWebRequest request;
request.ContentType = "image/jpeg";
request.ContentLength = byteArray.Length;
request.Method = "PUT";
imageToByteArray(img).CopyTo(byteArray, 0);
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(byteArray, 0, (int)Fs.Length);
requestStream.Flush();
requestStream.Close();
}
public byte[] imageToByteArray(Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Jpeg);
return ms.ToArray();
}
누가 어떻게 동영상 파일에 대해이 작업을 수행하는 생각을 가지고?
당신은 메모리에 두 번 전체를로드하고 있습니다. FileStream을 열고 청크로 요청 스트림에 복사하는 것이 더 좋습니다. http://stackoverflow.com/questions/230128/best-way-to-copy-between-two-stream-instances-c 및 http://stackoverflow.com/questions/1493594/writing-a-stream-to를 참조하십시오. -the-in-response-in-asp-net 및 http://stackoverflow.com/questions/674651/uploading-files-past-asp-net-request-length-limit – Will