c#base64 그림을 로컬로 저장
public string Base64ToImage(string base64Str,string path, string imgName)
{
string filename = "";// string
//
string hz = base64Str.Split(',')[0].Split(';')[0].Split('/')[1];
string[] str = base64Str.Split(','); //base64Str base64 ,
byte[] imageBytes = Convert.FromBase64String(str[1]);
// MemoryStream
MemoryStream memoryStream = new MemoryStream(imageBytes, 0, imageBytes.Length);
memoryStream.Write(imageBytes, 0, imageBytes.Length);
filename = path + imgName + "." + hz;//
string tmpRootDir = Server.MapPath(path); //
if (!Directory.Exists(tmpRootDir))
{
Directory.CreateDirectory(tmpRootDir);
}
string imagesurl2 = tmpRootDir + imgName + "." + hz; //
//
Image image = Image.FromStream(memoryStream);
//
string iname = DateTime.Now.ToString("yyMMddhhmmss");
image.Save(imagesurl2); // Server.MapPath("pic\\") + iname + "." + hz
return filename;
} 이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
ssh를 통해 이미지 데이터와 같은 바이너리를 서버로 보냅니다.ssh로부터 웹 컨텐츠 등을 편집하고 있을 때, 약간의 화상을 서버상에 보내고 싶을 때가 있다. 또 하나 콘솔을 열어 거기에서 scp하거나 전송용의 어플리케이션을 기동하거나 해도 괜찮지만, 괜찮다. 몇 대의 서버를 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.