파일 잘 올라 갑니다.
참고 하세요~
<%@ Import Namespace="System.IO" %>
<script runat="server" language="C#">
void Page_Load() {
//HtmlInputFile 클래스에서 제공하는 프러퍼티중에서 PostedFile은
//업로드된 파일이 없다면 PostedFile은 null입니다.
//HttpPostedFile 개체는 다음과 같은 4개의 프로퍼티를 제공합니다.
//ContentLength : 업로드된 파일의 크기
//ContentType : 업로드된 파일의 MIME 타입(예 : image/gif)
//FileName : 클라이언트 컴퓨터 상에서의 업로드된 파일의 전체경로 (예 : c:tempMyPicture.gif)
//InputStream : 업로드된 데이터를 엑서스하기 위한 스트림 개체
if( filMyFile.PostedFile != null )
{
// HttpPostedFile 개체를 받아 옵니다.
HttpPostedFile myFile = filMyFile.PostedFile;
//파일 사이즈를 받아 옵니다.
int nFileLen = myFile.ContentLength;
//파일 사이즈 만큼 바이트 배열을 잡는다.
byte[] myData = new byte[nFileLen];
//스트림에서 파일을 읽어 바이트 배열에 담자.
myFile.InputStream.Read(myData, 0, nFileLen);
// 파일 생성
string strPath = @"D:\강의자료\울산\예제\ASP-NET" + Path.GetFileName(myFile.FileName);
FileStream newFile = new FileStream(strPath, FileMode.Create);
// byte 배열의 내용을 파일에 씁니다.
newFile.Write(myData, 0, myData.Length);
// 파일을 닫습니다.
newFile.Close();
}
}
</script>
<html><head></head><body>
<form id="Form1" method="post" runat="server" enctype="multipart/form-data">
<input id="filMyFile" type="file" runat="server"><br>
<input type="submit">
</form>
</body>
</html>
참고 하세요~
<%@ Import Namespace="System.IO" %>
<script runat="server" language="C#">
void Page_Load() {
//HtmlInputFile 클래스에서 제공하는 프러퍼티중에서 PostedFile은
//업로드된 파일이 없다면 PostedFile은 null입니다.
//HttpPostedFile 개체는 다음과 같은 4개의 프로퍼티를 제공합니다.
//ContentLength : 업로드된 파일의 크기
//ContentType : 업로드된 파일의 MIME 타입(예 : image/gif)
//FileName : 클라이언트 컴퓨터 상에서의 업로드된 파일의 전체경로 (예 : c:tempMyPicture.gif)
//InputStream : 업로드된 데이터를 엑서스하기 위한 스트림 개체
if( filMyFile.PostedFile != null )
{
// HttpPostedFile 개체를 받아 옵니다.
HttpPostedFile myFile = filMyFile.PostedFile;
//파일 사이즈를 받아 옵니다.
int nFileLen = myFile.ContentLength;
//파일 사이즈 만큼 바이트 배열을 잡는다.
byte[] myData = new byte[nFileLen];
//스트림에서 파일을 읽어 바이트 배열에 담자.
myFile.InputStream.Read(myData, 0, nFileLen);
// 파일 생성
string strPath = @"D:\강의자료\울산\예제\ASP-NET" + Path.GetFileName(myFile.FileName);
FileStream newFile = new FileStream(strPath, FileMode.Create);
// byte 배열의 내용을 파일에 씁니다.
newFile.Write(myData, 0, myData.Length);
// 파일을 닫습니다.
newFile.Close();
}
}
</script>
<html><head></head><body>
<form id="Form1" method="post" runat="server" enctype="multipart/form-data">
<input id="filMyFile" type="file" runat="server"><br>
<input type="submit">
</form>
</body>
</html>
| 12-27 | 2810 | |||
| 12-11 | 2043 | |||
| 53 | 03-15 | 1867 | ||
| 52 | 01-31 | 2024 | ||
| 51 | 01-31 | 2988 | ||
| 50 | 01-31 | 1560 | ||
| 49 | 01-19 | 1882 | ||
| 48 | 01-11 | 1756 | ||
| 47 | 01-03 | 2332 | ||
| 46 | 12-27 | 2810 | ||
| 45 | 12-19 | 1969 | ||
| 44 | 12-14 | 1949 | ||
| 43 | 12-11 | 2043 | ||
| 42 | 12-09 | 1589 | ||
| 41 | 12-01 | 1813 | ||
| 40 | 12-01 | 2039 | ||
| 39 | 12-01 | 1465 | ||
댓글 없음:
댓글 쓰기