일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- digitalRead
- Android
- wpf
- sensor
- inheritance
- java
- length
- public
- UNO
- file access
- APP
- Class
- stream
- atmega328
- Encapusulation
- Barcode
- SERIAL
- Read
- Pointer
- compare
- memory
- mfc
- 3D
- c++
- preprocessing
- Contour
- Unity
- parameter
- flutter
- aduino
- Today
- Total
폴크(FOLC)
C# 테크닉 - Image 파일 다운로드 본문
# web site 에 존재하는 Image 를 Local Storage 에 저장하는 방법
> http 방식 이용
# 관련 소스 코드
> using System.Net;
> HttpWebRequest REQ = (HttpWebRequest)WebRequest.Create(cover_image_full_path);
> HttpWebResponse RES = (HttpWebResponse)request.GetResponse();
> bool bImage = RES.ContentType.EndsWith("image/jpeg", StringComparison.OrdinalIgnoreCase);
> if (bImage)
> {
> using (Stream inputStream = response.GetResponseStream())
> {
> using (Stream outputStream = File.OpenWrite(strFileName))
> {
> byte[] buffer = new byte[8192];
> int bytesRead;
> do
> {
> bytesRead = inputStream.Read(buffer, 0, buffer.Length);
> outputStream.Write(buffer, 0, bytesRead);
> } while (bytesRead != 0);
}
}
}
'C#, WF, WPF(.NET) > C#, WF, WPF(.NET) 테크닉' 카테고리의 다른 글
C# 테크닉 - 로그 기록하기 ( log4net ) (0) | 2021.10.13 |
---|---|
C# 테크닉 - xls 파일에 Local Image 추가하기 (0) | 2021.10.11 |
C# 테크닉 - xls 파일에 Image 추가 (0) | 2021.09.27 |
C# 테크닉 - TrayIcon (0) | 2021.09.07 |
WF 테크닉 - xls 파일 연동 (0) | 2021.08.03 |