티스토리 뷰

정보 보관 ver1.0

Content-Type

James Wetzel 2011. 11. 4. 16:35

<%

    response.setHeader("Content-Type", "aapplication/x-msdownload");
    response.setHeader("Content-Disposition", "attachment;filename=파일명;");
%>

<%=파일내용출력%>

 

요케 하면 무조건 download가 가능하다..

 

이래도 이해가 안가신다면

 

' Feel Free to Add Your Own Content-Types Here
    Select Case strFileType
        Case ".asf"
            ContentType = "video/x-ms-asf"
        Case ".avi"
            ContentType = "video/avi"
        Case ".doc"
            ContentType = "application/msword"
        Case ".zip"
            ContentType = "application/zip"
        Case ".xls"
            ContentType = "application/vnd.ms-excel"
       ' Case ".ppt"
        '    ContentType = "application/vnd.ms-PowerPoint"
        Case ".gif"
            ContentType = "image/gif"
        Case ".jpg", "jpeg"
            ContentType = "image/jpeg"
        Case ".wav"
            ContentType = "audio/wav"
        Case ".mp3"
            ContentType = "audio/mpeg3"
        Case ".mpg", "mpeg"
            ContentType = "video/mpeg"
        Case ".rtf"
            ContentType = "application/rtf"
        Case ".htm", "html"
            ContentType = "text/html"
        Case ".asp"
            ContentType = "text/asp"
        Case Else
            'Handle All Other Files
            ContentType = "application/octet-stream"
    End Select
[자료 출처]
http://blog.ohmynews.com/icorea77/35629 

상세 내용 : http://www.iana.org/assignments/media-types/index.html 

728x90
반응형