1 / 1
" 파일"으로 검색하여,
3 건의 기사가 검색 되었습니다.
-
2014-11-15ASP에서 파일을 다운로드 하는 경우에는 ContentType을 "application/unknown"으로 설정해주어야 MINE 연결이 해제되고 저장하는 방식으로 처리된다.그리고 헤더를 보낸후에 파일 내용을 바이너리형식으로 보내 주어야 하는데 이를 위하여 파일을 Strem형식으로 읽어 보내주면 된다.한가지 주의점은 저장파일의 이름변수의 값이 PC에서 파일이름으로 사용할 수 없는 문자가 포함되지 않도록 되어있어여하는데 함수 RefineFileName는 이값들을 정제해주는 기능의 함수로 잘못된 파일이름으로 인한 에러를 방지해 줄 수 있다, <%function FileDownload( cPathFile, cSaveFileName )Response.ContentType = "application/unknown"Response.AddHeader "Content-Disposition","attachment; filename=" & cSaveFileName&" "Response.BinaryWrite GetFileStream( cPathFile )FileDownload = nullend functionfunction GetFileStream( cPathFile )dim oStream, sFileset oStream = Server.CreateObject("ADODB.Stream")oStream.OpenoStream.Type = 1oStream.LoadFromFile cPathFilesFile = oStream.Readset oStream = nothingGetFileStream = sFileend functionfunction RefineFileName( c )c = Replace( c, "/", "" )c = Replace( c, "?", "" )c = Replace( c, "*", "" )c = Replace( c, ">", "]" )c = Replace( c, "<", "[" )c = Replace( c, "|", "-" )c = Replace( c, ":", "-" )RefineFileName = cend function%>
-
2014-05-03마이크로소프트의 DBMS인 MS-SQL은 현재 2014버전이 나왔지만 8플랫폼에 설치해야하기 때문에 7이나 server 2008이하에서 2008을 설치 해야 한다.Express는 Oracle의 mysql처럼 사용자에게 무료로 제공되는 버전이다. 다만 파일 사이즈가 최대 4G를 넘지 못하는 점이 있어 대형DB나 웨어하우징에는 사용하기 어렵다. 하지만 개발 시 사용하거나 웹서버에서 사용하기에는 부족함이 없다, (개발단계에서 4G가 넘는 파일은 사용하는 경우는 웨어하우징 정도일듯 한데, 이런 경우는 개발 자원 자체가 데스크탑 수준 이상으로 필요하기 떄문에 컨텐트를 DB로 처리하는 경우를 제외하고 거의 처리 된다고 볼 수 있다)소규모 개발 혹은 단일노드 개발에서도 Office의 Access를 사용하기보다는 Express를 사용하는 것을 추천한다.마이크로소프사의 다운로드 사이트http://www.microsoft.com/ko-kr/download/details.aspx?id=22973x86, x64버전 중 OS에 맞는것을 다운로드하여 설치하면 된다. (IA64 시스템에서 지원되지 않는다.)1. 설치 전 OS의 모든 업데이트는 필수 이다.2. .Net Framework을 필요로 하는데 3.5 SP1 이상이 필요하다. (http://www.microsoft.com/ko-kr/download/details.aspx?id=22)3. Windows Installer 4.5 설치 (http://support.microsoft.com/kb/942288)4. Power Shell 설치 (http://technet.microsoft.com/ko-kr/windowsserver/bb512919.aspx)OS 업데이트만 완료하고 설치를 진행하여도 필요한 소프웨어를 추가 자동설치 하거나, 메세지가 나올 떄 처리하여도 무방하다. (OS에 따라 미리설치하여야 하는 경우도 있기 때문에 위의 2,3,4, 소프트웨어를 미리 설치)
-
2014-05-01그 동안 만들어 사용하던 날짜,시간 관련 함수들을 모아 봤다.ASP에선 날짜/시간을 출력하는 경우 시스템의 날짜형식으로 출력이 된다.적합한 모양으로 바꾸어 출력 되도록 하는것들이 대부분 함수들이다.모아보니 함수들이 많은것 같은데 필요할 때마다 추가한것이라 한번씩은 용도가 있었던것이라 참고 하시거나 사용안할듯 한것들은 제거 하여 재구성하여 사용 하길 추천 한다.GetFullDateTimeH(), GetFullDateH(): 구분자를 "-"로 출력 한다. ** in-line query 로 DB에 저장하는 경우 이 형식으로 날짜를 표현해야 한다.GetFullDateTimeON() : 날짜/시간의 숫자 값만 출력한다. ** 임시파일의 파일명 생성시 4~6자리의 랜덤 값과 사용하면 중복을 쉽게 피할 수 있다.GetMonthLastDate(): 해당월의 마지막일자를 구한다. ** 기간 설정 시 유용 하다.CDateWithCheck() : 변수가 유효한 날짜로 변경이 가능한 경우에만 변경된다. ** 날짜 형식은 javascript에서 유효성을 확인 하지만 실제 데이타 처리시에도 반드시 확인 하길 추천 한다.Date연산 함수들: 자주 사용되는 연산 규칙들을 함수로 구성 했다.UNIX Time : 초단위로 출력되는 숫자로 경과시간을 초단위로 나타낼 때 유효하다 ** 경과 시간 구하기 iPastSecond = DateTime2UnixTime( dEnd ) - DateTime2UnixTime( dStart )'============================================' DateTime functions'============================================function GetFullDateTime( dNow )GetFullDateTime = Year(dNow)&"."&FillZero(Month(dNow),2)&"."&FillZero(Day(dNow),2) &" "& FillZero(Hour(dNow),2)&":"&FillZero(Minute(dNow),2)&":"&FillZero(Second(dNow),2)end Functionfunction GetFullDateTimeT( dNow )GetFullDateTimeT = Year(dNow)&"-"&FillZero(Month(dNow),2)&"-"&FillZero(Day(dNow),2) &"T"& FillZero(Hour(dNow),2)&":"&FillZero(Minute(dNow),2)&":"&FillZero(Second(dNow),2)end Functionfunction GetFullDateTimeH( dNow )GetFullDateTimeH = Year(dNow)&"-"&FillZero(Month(dNow),2)&"-"&FillZero(Day(dNow),2) &" "& FillZero(Hour(dNow),2)&":"&FillZero(Minute(dNow),2)&":"&FillZero(Second(dNow),2)end Functionfunction GetFullDateTimeKor( dNow )GetFullDateTimeKor = Year(dNow)&"년 "&Month(dNow)&"월 "&Day(dNow)&"일 ("& WeekDayName(Weekday(dNow), True)&") "& FillZero(Hour(dNow),2)&":"&FillZero(Minute(dNow),2)&":"&FillZero(Second(dNow),2)end Functionfunction GetFullDate( dNow )GetFullDate = Year(dNow)&"."&FillZero(Month(dNow),2)&"."&FillZero(Day(dNow),2)end Functionfunction GetFullDateH( dNow )GetFullDateH = Year(dNow)&"-"&FillZero(Month(dNow),2)&"-"&FillZero(Day(dNow),2)end Functionfunction GetFullDateKor( dNow )GetFullDateKor = Year(dNow)&"년 "&Month(dNow)&"월 "&Day(dNow)&"일"end Function'===== only numericfunction GetFullDateTimeON( dNow )GetFullDateTimeON = Year(dNow) & FillZero(Month(dNow),2) & FillZero(Day(dNow),2) & FillZero(Hour(dNow),2) & FillZero(Minute(dNow),2) & FillZero(Second(dNow),2)end Functionfunction GetFullDateTimeONHM( dNow )GetFullDateTimeONHM = Year(dNow) & FillZero(Month(dNow),2) & FillZero(Day(dNow),2) & FillZero(Hour(dNow),2) & FillZero(Minute(dNow),2)end Functionfunction GetTime( dNow )GetTime = FillZero(Hour(dNow),2) &":"& FillZero(Minute(dNow),2) &":"& FillZero(Second(dNow),2)end functionfunction GetTimeON( dNow )GetTimeON = FillZero(Hour(dNow),2) & FillZero(Minute(dNow),2) & FillZero(Second(dNow),2)end functionfunction GetFullDateON( dNow )GetFullDateON = Year(dNow) & FillZero(Month(dNow),2) & FillZero(Day(dNow),2)end Functionfunction GetFullDateON6( dNow )GetFullDateON6 = Right(Year(dNow),2) & FillZero(Month(dNow),2) & FillZero(Day(dNow),2)end Functionfunction ONDateTime2DateTime( cDateTime14 )ONDateTime2DateTime = ONDate2DateTime(Mid(cDateTime14,1,8))&" "&ONTime2DateTime(Mid(cDateTime14,9,6))end functionfunction ONDate2DateTime( cDate8 )dim cReturnif (cDate8="") or ISNull(cDate8) thencReturn = ""elsecReturn = Mid(cDate8,1,4) &"-"& Mid(cDate8,5,2) &"-"& Mid(cDate8,7,2)end ifONDate2DateTime = cReturnend functionfunction ONTime2DateTime( cTime6 )dim cReturnif (cTime6="") or ISNull(cTime6) thencReturn = ""elsecReturn = Mid(cTime6,1,2) &":"& Mid(cTime6,3,2) &":"& Mid(cTime6,5,2)end ifONTime2DateTime = cReturnend functionfunction GetYearMonth( dNow )GetYearMonth = FillZero(Year(dNow),4)&"/"& FillZero(Month(dNow),2)end Functionfunction GetMonthDay( dNow )GetMonthDay = FillZero(Month(dNow),2)&"/"& FillZero(Day(dNow),2)end Functionfunction GetHourMinute( dNow )if IsNull(dNow) thenGetHourMinute = ""elseGetHourMinute = FillZero(Hour(dNow),2)&":"& FillZero(Minute(dNow),2)end ifend Functionfunction GetHourMinuteSecond( dNow )if IsNull(dNow) thenGetHourMinuteSecond = ""elseGetHourMinuteSecond = FillZero(Hour(dNow),2)&":"& FillZero(Minute(dNow),2)&":"& FillZero(Second(dNow),2)end ifend functionfunction CDateWithCheck( cDate8 )dim cDate10cDate10 = ONDate2DateTime(cDate8)if IsDate( cDate10 ) thenCDateWithCheck = CDate( cDate10 )elseCDateWithCheck = nullend ifend functionfunction CDateWithCheck10( cDate10 )if IsDate( cDate10 ) thenCDateWithCheck10 = CDate( cDate10 )elseCDateWithCheck10 = nullend ifend functionfunction CheckDateTime( cDate8 )CheckDateTime = IsDate( ONDate2DateTime(cDate8) )end functionfunction CheckDateTimeNull( cDate8 )CheckDateTimeNull = (IsDate( ONDate2DateTime(cDate8) ) or IsNull(cDate8))end functionfunction GetMonthLastDate( iYear, iMonth )dim cNextMonthFistDateif (iMonth=12) thencNextMonthFistDate=FillZero((iYear+1),4)&"0101"elsecNextMonthFistDate=FillZero(iYear,4)&FillZero((iMonth+1),2)&"01"end ifGetMonthLastDate = GetFullDateON(CDateWithCheck(cNextMonthFistDate)-1)&" 23:59:59"end functionfunction GetMonthLastDay( iYear, iMonth )dim cNextMonthFistDateif (iMonth=12) thencNextMonthFistDate=FillZero((iYear+1),4)&"-01-01"elsecNextMonthFistDate=FillZero(iYear,4)&"-"&FillZero((iMonth+1),2)&"-01"end ifGetMonthLastDay = Day(CDate(cNextMonthFistDate)-1)end functionfunction CmpStartEndMonth( iStartYear, iStartMonth, iEndYear, iEndMonth )dim iCmpStartDate, iCmpEndDateiCmpStartDate = CintZero(FillZero(iStartYear,4)&FillZero(iStartMonth,2))iCmpEndDate = CIntZero(FillZero(iEndYear,4)&FillZero(iEndMonth,2))CmpStartEndMonth = CBool(iCmpStartDate > iCmpEndDate)end function'== Date add functionsfunction YearMonthAddMonthGetYear( iYear, iMonth, iAddMonth )YearMonthAddMonthGetYear = Year(YearMonthAddMonth( iYear, iMonth, iAddMonth ))end functionfunction YearMonthAddMonthGetMonth( iYear, iMonth, iAddMonth )YearMonthAddMonthGetMonth = Month(YearMonthAddMonth( iYear, iMonth, iAddMonth ))end functionfunction YearMonthAddMonth( iYear, iMonth, iAddMonth )YearMonthAddMonth = DateAdd( "m", iAddMonth, CDate(FillZero(iYear,4)&"-"&FillZero(iMonth,2)&"-01") )end functionfunction AddMonthGetMonth( dDate, iMonth )AddMonthGetMonth = Month(AddMonth( dDate, iMonth ))end functionfunction AddMonthGetYear( dDate, iMonth )AddMonthGetYear = Year(AddMonth( dDate, iMonth ))end functionfunction AddMonth( dDate, iMonth )AddMonth = DateAdd( "m", iMonth, dDate )end function'== UNIX Timefunction DateTime2UnixTime( dDateTime )DateTime2UnixTime = DateDiff( "s", "01/01/1970 00:00:00", dDateTime )end functionfunction UnixTime2DateTime( iUnixTime )UnixTime2DateTime = DateAdd( "s", iUnixTime, "01/01/1970 00:00:00" )end functionfunction MonthNameEng( iMonth )dim cReturnselect case iMonthcase 1 cReturn = "January"case 2 cReturn = "February"case 3 cReturn = "March"case 4 cReturn = "April"case 5 cReturn = "May"case 6 cReturn = "June"case 7 cReturn = "July"case 8 cReturn = "August"case 9 cReturn = "September"case 10 cReturn = "October"case 11 cReturn = "November"case 12 cReturn = "December"end selectMonthNameEng = cReturnend function
1
