前后端分离实现文件下载功能

前后端分离实现文件下载功能

这里以接口下载一个pdf文件来举例

1、接口下载pdf文件

controller

@RequestMapping(value = "/downloadFile",method = RequestMethod.GET)
public Object downloadFile(HttpServletRequest request, HttpServletResponse httpServletResponse){
    //1:在httpServletRequest中获取请求参数,这里假设只有一个。
    Long paramId = Long.valueOf(request.getParameter("paramId"));
    
    //2:根据参数获取下载的文件名(具体根据业务需要 , 来命名文件)
    String fileName = fileService.getFileName(paramId);
    //将文件名转码
    fileName = URLEncoder.encode(fileName,"UTF-8");
    
    //3:获得文件字节流输出的字符串
    String byteArrStr = fileService.downloadFile(paramId);
    
    //4:将字符串转为ByteArrayInputStream 并且设定字符集为ISO-8859-1
    ByteArrayInputStream inputStream = new ByteArrayInputStream(zipData.getBytes("ISO-8859-1"));
    
    //用于后面的写入
    byte[] b = new byte[2048];
    int len;
    
    try{
        
     	//5:将字节流写入httpServletResponse中
    	//1设置将字节流写入httpServletResponse中响应类型(这里举例为pdf文件),文章最后会罗列一些常见的响应类型
    	httpServletResponse.setContentType("application/pdf");
    	//2设置响应头信息
    	httpServletResponse.setHeader("Content-Disposition","attachment;filename=\"" + fileName +"\"");
        while ((len = inputStream.read(b)) > 0)
            //写入字节流数组
            httpServletResponse.getOutputStream().write(b, 0, len);
        inputStream.close();
    }catch(IOException e){
        e.printStackTrace();
    }
    return null;
    
    
    
}

service

public String downloadFile(Long paramId){
   
    System.out.println("开始生成文件");
    String result = "";
    //这里假设objs是根据参数paramId 查询到  需要  写入到文档中的数据
    List<Object> objs = new ArrayList<>();
    
    // 创建字节数组输出流,用于返回压缩后的输出流字节数组
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    // 创建文档
    Document doc = new Document(null, 0, 0, 0, 0);
    
    // 写入PDF文档
    PdfWriter.getInstance(doc, baos);
    for(Object obj : objs){
       //将数据写入pdf中,具体实现根据业务而定
    }
    if (doc.isOpen()) doc.close();
    // 字节数组输出流转为字符串并设置编码
    result = new String(baos.toByteArray(), "ISO-8859-1");
    baos.close();
    
    System.out.println("生成文件完成");
    return result;
}

前端下载按钮

<a href="ip:端口/downloadFile" >下载pdf</a>
常见的响应类型

版权声明:
以下内容为CSDN博主「Lieforlove」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Lieforlove/article/details/90202258

‘.load’: ‘text/html’,

‘.’: ‘application/vnd.lotus—’,

‘.ds’: ‘image/x-ds’,

‘.g’: ‘video/gpp’,

‘.ga’: ‘video/gpp’,

‘.gp’: ‘video/gpp’,

‘.gpp’: ‘video/gpp’,

‘.’: ‘application/x-t’,

‘.’: ‘audio/x-mod’,

‘.z’: ‘application/x-z-compressed’,

‘.a’: ‘application/x-archive’,

‘.aac’: ‘audio/mp’,

‘.abw’: ‘application/x-abiword’,

‘.abw.crashed’: ‘application/x-abiword’,

‘.abw.gz’: ‘application/x-abiword’,

‘.ac’: ‘audio/ac’,

‘.ace’: ‘application/x-ace’,

‘.adb’: ‘text/x-adasrc’,

‘.ads’: ‘text/x-adasrc’,

‘.afm’: ‘application/x-font-afm’,

‘.ag’: ‘image/x-applix-graphics’,

‘.ai’: ‘application/illustrator’,

‘.aif’: ‘audio/x-aiff’,

‘.aifc’: ‘audio/x-aiff’,

‘.aiff’: ‘audio/x-aiff’,

‘.al’: ‘application/x-perl’,

‘.alz’: ‘application/x-alz’,

‘.amr’: ‘audio/amr’,

‘.ani’: ‘application/x-navi-animation’,

‘.anim[-j]’: ‘video/x-anim’,

‘.anx’: ‘application/annodex’,

‘.ape’: ‘audio/x-ape’,

‘.arj’: ‘application/x-arj’,

‘.arw’: ‘image/x-sony-arw’,

‘.as’: ‘application/x-applix-spreadsheet’,

‘.asc’: ‘text/plain’,

‘.asf’: ‘video/x-ms-asf’,

‘.asp’: ‘application/x-asp’,

‘.ass’: ‘text/x-ssa’,

‘.asx’: ‘audio/x-ms-asx’,

‘.atom’: ‘application/atom+xml’,

‘.au’: ‘audio/basic’,

‘.avi’: ‘video/x-msvideo’,

‘.aw’: ‘application/x-applix-word’,

‘.awb’: ‘audio/amr-wb’,

‘.awk’: ‘application/x-awk’,

‘.axa’: ‘audio/annodex’,

‘.axv’: ‘video/annodex’,

‘.bak’: ‘application/x-trash’,

‘.bcpio’: ‘application/x-bcpio’,

‘.bdf’: ‘application/x-font-bdf’,

‘.bib’: ‘text/x-bibtex’,

‘.bin’: ‘application/octet-stream’,

‘.blend’: ‘application/x-blender’,

‘.blender’: ‘application/x-blender’,

‘.bmp’: ‘image/bmp’,

‘.bz’: ‘application/x-bzip’,

‘.bz’: ‘application/x-bzip’,

‘.c’: ‘text/x-csrc’,

‘.c++’: ‘text/x-c++src’,

‘.cab’: ‘application/vnd.ms-cab-compressed’,

‘.cb’: ‘application/x-cb’,

‘.cbr’: ‘application/x-cbr’,

‘.cbt’: ‘application/x-cbt’,

‘.cbz’: ‘application/x-cbz’,

‘.cc’: ‘text/x-c++src’,

‘.cdf’: ‘application/x-netcdf’,

‘.cdr’: ‘application/vnd.corel-draw’,

‘.cer’: ‘application/x-x-ca-cert’,

‘.cert’: ‘application/x-x-ca-cert’,

‘.cgm’: ‘image/cgm’,

‘.chm’: ‘application/x-chm’,

‘.chrt’: ‘application/x-kchart’,

‘.class’: ‘application/x-java’,

‘.cls’: ‘text/x-tex’,

‘.cmake’: ‘text/x-cmake’,

‘.cpio’: ‘application/x-cpio’,

‘.cpio.gz’: ‘application/x-cpio-compressed’,

‘.cpp’: ‘text/x-c++src’,

‘.cr’: ‘image/x-canon-cr’,

‘.crt’: ‘application/x-x-ca-cert’,

‘.crw’: ‘image/x-canon-crw’,

‘.cs’: ‘text/x-csharp’,

‘.csh’: ‘application/x-csh’,

‘.css’: ‘text/css’,

‘.cssl’: ‘text/css’,

‘.csv’: ‘text/csv’,

‘.cue’: ‘application/x-cue’,

‘.cur’: ‘image/x-win-bitmap’,

‘.cxx’: ‘text/x-c++src’,

‘.d’: ‘text/x-dsrc’,

‘.dar’: ‘application/x-dar’,

‘.dbf’: ‘application/x-dbf’,

‘.dc’: ‘application/x-dc-rom’,

‘.dcl’: ‘text/x-dcl’,

‘.dcm’: ‘application/dicom’,

‘.dcr’: ‘image/x-kodak-dcr’,

‘.dds’: ‘image/x-dds’,

‘.deb’: ‘application/x-deb’,

‘.der’: ‘application/x-x-ca-cert’,

‘.desktop’: ‘application/x-desktop’,

‘.dia’: ‘application/x-dia-diagram’,

‘.diff’: ‘text/x-patch’,

‘.divx’: ‘video/x-msvideo’,

‘.djv’: ‘image/vnd.djvu’,

‘.djvu’: ‘image/vnd.djvu’,

‘.dng’: ‘image/x-adobe-dng’,

‘.doc’: ‘application/msword’,

‘.docbook’: ‘application/docbook+xml’,

‘.docm’: ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,

‘.docx’: ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,

‘.dot’: ‘text/vnd.graphviz’,

‘.dsl’: ‘text/x-dsl’,

‘.dtd’: ‘application/xml-dtd’,

‘.dtx’: ‘text/x-tex’,

‘.dv’: ‘video/dv’,

‘.dvi’: ‘application/x-dvi’,

‘.dvi.bz’: ‘application/x-bzdvi’,

‘.dvi.gz’: ‘application/x-gzdvi’,

‘.dwg’: ‘image/vnd.dwg’,

‘.dxf’: ‘image/vnd.dxf’,

‘.e’: ‘text/x-eiffel’,

‘.egon’: ‘application/x-egon’,

‘.eif’: ‘text/x-eiffel’,

‘.el’: ‘text/x-emacs-lisp’,

‘.emf’: ‘image/x-emf’,

‘.emp’: ‘application/vnd.emusic-emusic_package’,

‘.ent’: ‘application/xml-external-parsed-entity’,

‘.eps’: ‘image/x-eps’,

‘.eps.bz’: ‘image/x-bzeps’,

‘.eps.gz’: ‘image/x-gzeps’,

‘.epsf’: ‘image/x-eps’,

‘.epsf.bz’: ‘image/x-bzeps’,

‘.epsf.gz’: ‘image/x-gzeps’,

‘.epsi’: ‘image/x-eps’,

‘.epsi.bz’: ‘image/x-bzeps’,

‘.epsi.gz’: ‘image/x-gzeps’,

‘.epub’: ‘application/epub+zip’,

‘.erl’: ‘text/x-erlang’,

‘.es’: ‘application/ecmascript’,

‘.etheme’: ‘application/x-e-theme’,

‘.etx’: ‘text/x-setext’,

‘.exe’: ‘application/x-ms-dos-executable’,

‘.exr’: ‘image/x-exr’,

‘.ez’: ‘application/andrew-inset’,

‘.f’: ‘text/x-fortran’,

‘.f’: ‘text/x-fortran’,

‘.f’: ‘text/x-fortran’,

‘.fb’: ‘application/x-fictionbook+xml’,

‘.fig’: ‘image/x-xfig’,

‘.fits’: ‘image/fits’,

‘.fl’: ‘application/x-fluid’,

‘.flac’: ‘audio/x-flac’,

‘.flc’: ‘video/x-flic’,

‘.fli’: ‘video/x-flic’,

‘.flv’: ‘video/x-flv’,

‘.flw’: ‘application/x-kivio’,

‘.fo’: ‘text/x-xslfo’,

‘.for’: ‘text/x-fortran’,

‘.g’: ‘image/fax-g’,

‘.gb’: ‘application/x-gameboy-rom’,

‘.gba’: ‘application/x-gba-rom’,

‘.gcrd’: ‘text/directory’,

‘.ged’: ‘application/x-gedcom’,

‘.gedcom’: ‘application/x-gedcom’,

‘.gen’: ‘application/x-genesis-rom’,

‘.gf’: ‘application/x-tex-gf’,

‘.gg’: ‘application/x-sms-rom’,

‘.gif’: ‘image/gif’,

‘.glade’: ‘application/x-glade’,

‘.gmo’: ‘application/x-gettext-translation’,

‘.gnc’: ‘application/x-gnucash’,

‘.gnd’: ‘application/gnunet-directory’,

‘.gnucash’: ‘application/x-gnucash’,

‘.gnumeric’: ‘application/x-gnumeric’,

‘.gnuplot’: ‘application/x-gnuplot’,

‘.gp’: ‘application/x-gnuplot’,

‘.gpg’: ‘application/pgp-encrypted’,

‘.gplt’: ‘application/x-gnuplot’,

‘.gra’: ‘application/x-graphite’,

‘.gsf’: ‘application/x-font-type’,

‘.gsm’: ‘audio/x-gsm’,

‘.gtar’: ‘application/x-tar’,

‘.gv’: ‘text/vnd.graphviz’,

‘.gvp’: ‘text/x-google-video-pointer’,

‘.gz’: ‘application/x-gzip’,

‘.h’: ‘text/x-chdr’,

‘.h++’: ‘text/x-c++hdr’,

‘.hdf’: ‘application/x-hdf’,

‘.hh’: ‘text/x-c++hdr’,

‘.hp’: ‘text/x-c++hdr’,

‘.hpgl’: ‘application/vnd.hp-hpgl’,

‘.hpp’: ‘text/x-c++hdr’,

‘.hs’: ‘text/x-haskell’,

‘.htm’: ‘text/html’,

‘.html’: ‘text/html’,

‘.hwp’: ‘application/x-hwp’,

‘.hwt’: ‘application/x-hwt’,

‘.hxx’: ‘text/x-c++hdr’,

‘.ica’: ‘application/x-ica’,

‘.icb’: ‘image/x-tga’,

‘.icns’: ‘image/x-icns’,

‘.ico’: ‘image/vnd.microsoft.icon’,

‘.ics’: ‘text/calendar’,

‘.idl’: ‘text/x-idl’,

‘.ief’: ‘image/ief’,

‘.iff’: ‘image/x-iff’,

‘.ilbm’: ‘image/x-ilbm’,

‘.ime’: ‘text/x-imelody’,

‘.imy’: ‘text/x-imelody’,

‘.ins’: ‘text/x-tex’,

‘.iptables’: ‘text/x-iptables’,

‘.iso’: ‘application/x-cd-image’,

‘.iso’: ‘application/x-cd-image’,

‘.it’: ‘audio/x-it’,

‘.jk’: ‘image/jp’,

‘.jad’: ‘text/vnd.sun.jme.app-descriptor’,

‘.jar’: ‘application/x-java-archive’,

‘.java’: ‘text/x-java’,

‘.jng’: ‘image/x-jng’,

‘.jnlp’: ‘application/x-java-jnlp-file’,

‘.jp’: ‘image/jp’,

‘.jpc’: ‘image/jp’,

‘.jpe’: ‘image/jpeg’,

‘.jpeg’: ‘image/jpeg’,

‘.jpf’: ‘image/jp’,

‘.jpg’: ‘image/jpeg’,

‘.jpr’: ‘application/x-jbuilder-project’,

‘.jpx’: ‘image/jp’,

‘.js’: ‘application/javascript’,

‘.json’: ‘application/json’,

‘.jsonp’: ‘application/jsonp’,

‘.k’: ‘image/x-kodak-k’,

‘.kar’: ‘audio/midi’,

‘.karbon’: ‘application/x-karbon’,

‘.kdc’: ‘image/x-kodak-kdc’,

‘.kdelnk’: ‘application/x-desktop’,

‘.kexi’: ‘application/x-kexiproject-sqlite’,

‘.kexic’: ‘application/x-kexi-connectiondata’,

‘.kexis’: ‘application/x-kexiproject-shortcut’,

‘.kfo’: ‘application/x-kformula’,

‘.kil’: ‘application/x-killustrator’,

‘.kino’: ‘application/smil’,

‘.kml’: ‘application/vnd.google-earth.kml+xml’,

‘.kmz’: ‘application/vnd.google-earth.kmz’,

‘.kon’: ‘application/x-kontour’,

‘.kpm’: ‘application/x-kpovmodeler’,

‘.kpr’: ‘application/x-kpresenter’,

‘.kpt’: ‘application/x-kpresenter’,

‘.kra’: ‘application/x-krita’,

‘.ksp’: ‘application/x-kspread’,

‘.kud’: ‘application/x-kugar’,

‘.kwd’: ‘application/x-kword’,

‘.kwt’: ‘application/x-kword’,

‘.la’: ‘application/x-shared-library-la’,

‘.latex’: ‘text/x-tex’,

‘.ldif’: ‘text/x-ldif’,

‘.lha’: ‘application/x-lha’,

‘.lhs’: ‘text/x-literate-haskell’,

‘.lhz’: ‘application/x-lhz’,

‘.log’: ‘text/x-log’,

‘.ltx’: ‘text/x-tex’,

‘.lua’: ‘text/x-lua’,

‘.lwo’: ‘image/x-lwo’,

‘.lwob’: ‘image/x-lwo’,

‘.lws’: ‘image/x-lws’,

‘.ly’: ‘text/x-lilypond’,

‘.lyx’: ‘application/x-lyx’,

‘.lz’: ‘application/x-lzip’,

‘.lzh’: ‘application/x-lha’,

‘.lzma’: ‘application/x-lzma’,

‘.lzo’: ‘application/x-lzop’,

‘.m’: ‘text/x-matlab’,

‘.m’: ‘audio/x-mod’,

‘.mt’: ‘video/mpeg’,

‘.mu’: ‘audio/x-mpegurl’,

‘.mu’: ‘audio/x-mpegurl’,

‘.m’: ‘application/x-m’,

‘.ma’: ‘audio/mp’,

‘.mb’: ‘audio/x-mb’,

‘.mv’: ‘video/mp’,

‘.mab’: ‘application/x-markaby’,

‘.man’: ‘application/x-troff-man’,

‘.mbox’: ‘application/mbox’,

‘.md’: ‘application/x-genesis-rom’,

‘.mdb’: ‘application/vnd.ms-access’,

‘.mdi’: ‘image/vnd.ms-modi’,

‘.me’: ‘text/x-troff-me’,

‘.med’: ‘audio/x-mod’,

‘.metalink’: ‘application/metalink+xml’,

‘.mgp’: ‘application/x-magicpoint’,

‘.mid’: ‘audio/midi’,

‘.midi’: ‘audio/midi’,

‘.mif’: ‘application/x-mif’,

‘.minipsf’: ‘audio/x-minipsf’,

‘.mka’: ‘audio/x-matroska’,

‘.mkv’: ‘video/x-matroska’,

‘.ml’: ‘text/x-ocaml’,

‘.mli’: ‘text/x-ocaml’,

‘.mm’: ‘text/x-troff-mm’,

‘.mmf’: ‘application/x-smaf’,

‘.mml’: ‘text/mathml’,

‘.mng’: ‘video/x-mng’,

‘.mo’: ‘application/x-gettext-translation’,

‘.mo’: ‘audio/x-mo’,

‘.moc’: ‘text/x-moc’,

‘.mod’: ‘audio/x-mod’,

‘.mof’: ‘text/x-mof’,

‘.moov’: ‘video/quicktime’,

‘.mov’: ‘video/quicktime’,

‘.movie’: ‘video/x-sgi-movie’,

‘.mp+’: ‘audio/x-musepack’,

‘.mp’: ‘video/mpeg’,

‘.mp’: ‘audio/mpeg’,

‘.mp’: ‘video/mp’,

‘.mpc’: ‘audio/x-musepack’,

‘.mpe’: ‘video/mpeg’,

‘.mpeg’: ‘video/mpeg’,

‘.mpg’: ‘video/mpeg’,

‘.mpga’: ‘audio/mpeg’,

‘.mpp’: ‘audio/x-musepack’,

‘.mrl’: ‘text/x-mrml’,

‘.mrml’: ‘text/x-mrml’,

‘.mrw’: ‘image/x-minolta-mrw’,

‘.ms’: ‘text/x-troff-ms’,

‘.msi’: ‘application/x-msi’,

‘.msod’: ‘image/x-msod’,

‘.msx’: ‘application/x-msx-rom’,

‘.mtm’: ‘audio/x-mod’,

‘.mup’: ‘text/x-mup’,

‘.mxf’: ‘application/mxf’,

‘.n’: ‘application/x-n-rom’,

‘.nb’: ‘application/mathematica’,

‘.nc’: ‘application/x-netcdf’,

‘.nds’: ‘application/x-nintendo-ds-rom’,

‘.nef’: ‘image/x-nikon-nef’,

‘.nes’: ‘application/x-nes-rom’,

‘.nfo’: ‘text/x-nfo’,

‘.not’: ‘text/x-mup’,

‘.nsc’: ‘application/x-netshow-channel’,

‘.nsv’: ‘video/x-nsv’,

‘.o’: ‘application/x-object’,

‘.obj’: ‘application/x-tgif’,

‘.ocl’: ‘text/x-ocl’,

‘.oda’: ‘application/oda’,

‘.odb’: ‘application/vnd.oasis.opendocument.database’,

‘.odc’: ‘application/vnd.oasis.opendocument.chart’,

‘.odf’: ‘application/vnd.oasis.opendocument.formula’,

‘.odg’: ‘application/vnd.oasis.opendocument.graphics’,

‘.odi’: ‘application/vnd.oasis.opendocument.image’,

‘.odm’: ‘application/vnd.oasis.opendocument.text-master’,

‘.odp’: ‘application/vnd.oasis.opendocument.presentation’,

‘.ods’: ‘application/vnd.oasis.opendocument.spreadsheet’,

‘.odt’: ‘application/vnd.oasis.opendocument.text’,

‘.oga’: ‘audio/ogg’,

‘.ogg’: ‘video/x-theora+ogg’,

‘.ogm’: ‘video/x-ogm+ogg’,

‘.ogv’: ‘video/ogg’,

‘.ogx’: ‘application/ogg’,

‘.old’: ‘application/x-trash’,

‘.oleo’: ‘application/x-oleo’,

‘.opml’: ‘text/x-opml+xml’,

‘.ora’: ‘image/openraster’,

‘.orf’: ‘image/x-olympus-orf’,

‘.otc’: ‘application/vnd.oasis.opendocument.chart-template’,

‘.otf’: ‘application/x-font-otf’,

‘.otg’: ‘application/vnd.oasis.opendocument.graphics-template’,

‘.oth’: ‘application/vnd.oasis.opendocument.text-web’,

‘.otp’: ‘application/vnd.oasis.opendocument.presentation-template’,

‘.ots’: ‘application/vnd.oasis.opendocument.spreadsheet-template’,

‘.ott’: ‘application/vnd.oasis.opendocument.text-template’,

‘.owl’: ‘application/rdf+xml’,

‘.oxt’: ‘application/vnd.openofficeorg.extension’,

‘.p’: ‘text/x-pascal’,

‘.p’: ‘application/pkcs’,

‘.p’: ‘application/x-pkcs’,

‘.pb’: ‘application/x-pkcs-certificates’,

‘.ps’: ‘application/pkcs-signature’,

‘.pack’: ‘application/x-java-pack’,

‘.pak’: ‘application/x-pak’,

‘.par’: ‘application/x-par’,

‘.pas’: ‘text/x-pascal’,

‘.patch’: ‘text/x-patch’,

‘.pbm’: ‘image/x-portable-bitmap’,

‘.pcd’: ‘image/x-photo-cd’,

‘.pcf’: ‘application/x-cisco-vpn-settings’,

‘.pcf.gz’: ‘application/x-font-pcf’,

‘.pcf.z’: ‘application/x-font-pcf’,

‘.pcl’: ‘application/vnd.hp-pcl’,

‘.pcx’: ‘image/x-pcx’,

‘.pdb’: ‘chemical/x-pdb’,

‘.pdc’: ‘application/x-aportisdoc’,

‘.pdf’: ‘application/pdf’,

‘.pdf.bz’: ‘application/x-bzpdf’,

‘.pdf.gz’: ‘application/x-gzpdf’,

‘.pef’: ‘image/x-pentax-pef’,

‘.pem’: ‘application/x-x-ca-cert’,

‘.perl’: ‘application/x-perl’,

‘.pfa’: ‘application/x-font-type’,

‘.pfb’: ‘application/x-font-type’,

‘.pfx’: ‘application/x-pkcs’,

‘.pgm’: ‘image/x-portable-graymap’,

‘.pgn’: ‘application/x-chess-pgn’,

‘.pgp’: ‘application/pgp-encrypted’,

‘.php’: ‘application/x-php’,

‘.php’: ‘application/x-php’,

‘.php’: ‘application/x-php’,

‘.pict’: ‘image/x-pict’,

‘.pict’: ‘image/x-pict’,

‘.pict’: ‘image/x-pict’,

‘.pickle’: ‘application/python-pickle’,

‘.pk’: ‘application/x-tex-pk’,

‘.pkipath’: ‘application/pkix-pkipath’,

‘.pkr’: ‘application/pgp-keys’,

‘.pl’: ‘application/x-perl’,

‘.pla’: ‘audio/x-iriver-pla’,

‘.pln’: ‘application/x-planperfect’,

‘.pls’: ‘audio/x-scpls’,

‘.pm’: ‘application/x-perl’,

‘.png’: ‘image/png’,

‘.pnm’: ‘image/x-portable-anymap’,

‘.pntg’: ‘image/x-macpaint’,

‘.po’: ‘text/x-gettext-translation’,

‘.por’: ‘application/x-spss-por’,

‘.pot’: ‘text/x-gettext-translation-template’,

‘.ppm’: ‘image/x-portable-pixmap’,

‘.pps’: ‘application/vnd.ms-powerpoint’,

‘.ppt’: ‘application/vnd.ms-powerpoint’,

‘.pptm’: ‘application/vnd.openxmlformats-officedocument.presentationml.presentation’,

‘.pptx’: ‘application/vnd.openxmlformats-officedocument.presentationml.presentation’,

‘.ppz’: ‘application/vnd.ms-powerpoint’,

‘.prc’: ‘application/x-palm-database’,

‘.ps’: ‘application/postscript’,

‘.ps.bz’: ‘application/x-bzpostscript’,

‘.ps.gz’: ‘application/x-gzpostscript’,

‘.psd’: ‘image/vnd.adobe.photoshop’,

‘.psf’: ‘audio/x-psf’,

‘.psf.gz’: ‘application/x-gz-font-linux-psf’,

‘.psflib’: ‘audio/x-psflib’,

‘.psid’: ‘audio/prs.sid’,

‘.psw’: ‘application/x-pocket-word’,

‘.pw’: ‘application/x-pw’,

‘.py’: ‘text/x-python’,

‘.pyc’: ‘application/x-python-bytecode’,

‘.pyo’: ‘application/x-python-bytecode’,

‘.qif’: ‘image/x-quicktime’,

‘.qt’: ‘video/quicktime’,

‘.qtif’: ‘image/x-quicktime’,

‘.qtl’: ‘application/x-quicktime-media-link’,

‘.qtvr’: ‘video/quicktime’,

‘.ra’: ‘audio/vnd.rn-realaudio’,

‘.raf’: ‘image/x-fuji-raf’,

‘.ram’: ‘application/ram’,

‘.rar’: ‘application/x-rar’,

‘.ras’: ‘image/x-cmu-raster’,

‘.raw’: ‘image/x-panasonic-raw’,

‘.rax’: ‘audio/vnd.rn-realaudio’,

‘.rb’: ‘application/x-ruby’,

‘.rdf’: ‘application/rdf+xml’,

‘.rdfs’: ‘application/rdf+xml’,

‘.reg’: ‘text/x-ms-regedit’,

‘.rej’: ‘application/x-reject’,

‘.rgb’: ‘image/x-rgb’,

‘.rle’: ‘image/rle’,

‘.rm’: ‘application/vnd.rn-realmedia’,

‘.rmj’: ‘application/vnd.rn-realmedia’,

‘.rmm’: ‘application/vnd.rn-realmedia’,

‘.rms’: ‘application/vnd.rn-realmedia’,

‘.rmvb’: ‘application/vnd.rn-realmedia’,

‘.rmx’: ‘application/vnd.rn-realmedia’,

‘.roff’: ‘text/troff’,

‘.rp’: ‘image/vnd.rn-realpix’,

‘.rpm’: ‘application/x-rpm’,

‘.rss’: ‘application/rss+xml’,

‘.rt’: ‘text/vnd.rn-realtext’,

‘.rtf’: ‘application/rtf’,

‘.rtx’: ‘text/richtext’,

‘.rv’: ‘video/vnd.rn-realvideo’,

‘.rvx’: ‘video/vnd.rn-realvideo’,

‘.sm’: ‘audio/x-sm’,

‘.sam’: ‘application/x-amipro’,

‘.sami’: ‘application/x-sami’,

‘.sav’: ‘application/x-spss-sav’,

‘.scm’: ‘text/x-scheme’,

‘.sda’: ‘application/vnd.stardivision.draw’,

‘.sdc’: ‘application/vnd.stardivision.calc’,

‘.sdd’: ‘application/vnd.stardivision.impress’,

‘.sdp’: ‘application/sdp’,

‘.sds’: ‘application/vnd.stardivision.chart’,

‘.sdw’: ‘application/vnd.stardivision.writer’,

‘.sgf’: ‘application/x-go-sgf’,

‘.sgi’: ‘image/x-sgi’,

‘.sgl’: ‘application/vnd.stardivision.writer’,

‘.sgm’: ‘text/sgml’,

‘.sgml’: ‘text/sgml’,

‘.sh’: ‘application/x-shellscript’,

‘.shar’: ‘application/x-shar’,

‘.shn’: ‘application/x-shorten’,

‘.siag’: ‘application/x-siag’,

‘.sid’: ‘audio/prs.sid’,

‘.sik’: ‘application/x-trash’,

‘.sis’: ‘application/vnd.symbian.install’,

‘.sisx’: ‘x-epoc/x-sisx-app’,

‘.sit’: ‘application/x-stuffit’,

‘.siv’: ‘application/sieve’,

‘.sk’: ‘image/x-skencil’,

‘.sk’: ‘image/x-skencil’,

‘.skr’: ‘application/pgp-keys’,

‘.slk’: ‘text/spreadsheet’,

‘.smaf’: ‘application/x-smaf’,

‘.smc’: ‘application/x-snes-rom’,

‘.smd’: ‘application/vnd.stardivision.mail’,

‘.smf’: ‘application/vnd.stardivision.math’,

‘.smi’: ‘application/x-sami’,

‘.smil’: ‘application/smil’,

‘.sml’: ‘application/smil’,

‘.sms’: ‘application/x-sms-rom’,

‘.snd’: ‘audio/basic’,

‘.so’: ‘application/x-sharedlib’,

‘.spc’: ‘application/x-pkcs-certificates’,

‘.spd’: ‘application/x-font-speedo’,

‘.spec’: ‘text/x-rpm-spec’,

‘.spl’: ‘application/x-shockwave-flash’,

‘.spx’: ‘audio/x-speex’,

‘.sql’: ‘text/x-sql’,

‘.sr’: ‘image/x-sony-sr’,

‘.src’: ‘application/x-wais-source’,

‘.srf’: ‘image/x-sony-srf’,

‘.srt’: ‘application/x-subrip’,

‘.ssa’: ‘text/x-ssa’,

‘.stc’: ‘application/vnd.sun.xml.calc.template’,

‘.std’: ‘application/vnd.sun.xml.draw.template’,

‘.sti’: ‘application/vnd.sun.xml.impress.template’,

‘.stm’: ‘audio/x-stm’,

‘.stw’: ‘application/vnd.sun.xml.writer.template’,

‘.sty’: ‘text/x-tex’,

‘.sub’: ‘text/x-subviewer’,

‘.sun’: ‘image/x-sun-raster’,

‘.svcpio’: ‘application/x-svcpio’,

‘.svcrc’: ‘application/x-svcrc’,

‘.svg’: ‘image/svg+xml’,

‘.svgz’: ‘image/svg+xml-compressed’,

‘.swf’: ‘application/x-shockwave-flash’,

‘.sxc’: ‘application/vnd.sun.xml.calc’,

‘.sxd’: ‘application/vnd.sun.xml.draw’,

‘.sxg’: ‘application/vnd.sun.xml.writer.global’,

‘.sxi’: ‘application/vnd.sun.xml.impress’,

‘.sxm’: ‘application/vnd.sun.xml.math’,

‘.sxw’: ‘application/vnd.sun.xml.writer’,

‘.sylk’: ‘text/spreadsheet’,

‘.t’: ‘text/troff’,

‘.tt’: ‘text/x-txttags’,

‘.tar’: ‘application/x-tar’,

‘.tar.bz’: ‘application/x-bzip-compressed-tar’,

‘.tar.bz’: ‘application/x-bzip-compressed-tar’,

‘.tar.gz’: ‘application/x-compressed-tar’,

‘.tar.lzma’: ‘application/x-lzma-compressed-tar’,

‘.tar.lzo’: ‘application/x-tzo’,

‘.tar.xz’: ‘application/x-xz-compressed-tar’,

‘.tar.z’: ‘application/x-tarz’,

‘.tbz’: ‘application/x-bzip-compressed-tar’,

‘.tbz’: ‘application/x-bzip-compressed-tar’,

‘.tcl’: ‘text/x-tcl’,

‘.tex’: ‘text/x-tex’,

‘.texi’: ‘text/x-texinfo’,

‘.texinfo’: ‘text/x-texinfo’,

‘.tga’: ‘image/x-tga’,

‘.tgz’: ‘application/x-compressed-tar’,

‘.theme’: ‘application/x-theme’,

‘.themepack’: ‘application/x-windows-themepack’,

‘.tif’: ‘image/tiff’,

‘.tiff’: ‘image/tiff’,

‘.tk’: ‘text/x-tcl’,

‘.tlz’: ‘application/x-lzma-compressed-tar’,

‘.tnef’: ‘application/vnd.ms-tnef’,

‘.tnf’: ‘application/vnd.ms-tnef’,

‘.toc’: ‘application/x-cdrdao-toc’,

‘.torrent’: ‘application/x-bittorrent’,

‘.tpic’: ‘image/x-tga’,

‘.tr’: ‘text/troff’,

‘.ts’: ‘application/x-linguist’,

‘.tsv’: ‘text/tab-separated-values’,

‘.tta’: ‘audio/x-tta’,

‘.ttc’: ‘application/x-font-ttf’,

‘.ttf’: ‘application/x-font-ttf’,

‘.ttx’: ‘application/x-font-ttx’,

‘.txt’: ‘text/plain’,

‘.txz’: ‘application/x-xz-compressed-tar’,

‘.tzo’: ‘application/x-tzo’,

‘.ufraw’: ‘application/x-ufraw’,

‘.ui’: ‘application/x-designer’,

‘.uil’: ‘text/x-uil’,

‘.ult’: ‘audio/x-mod’,

‘.uni’: ‘audio/x-mod’,

‘.uri’: ‘text/x-uri’,

‘.url’: ‘text/x-uri’,

‘.ustar’: ‘application/x-ustar’,

‘.vala’: ‘text/x-vala’,

‘.vapi’: ‘text/x-vala’,

‘.vcf’: ‘text/directory’,

‘.vcs’: ‘text/calendar’,

‘.vct’: ‘text/directory’,

‘.vda’: ‘image/x-tga’,

‘.vhd’: ‘text/x-vhdl’,

‘.vhdl’: ‘text/x-vhdl’,

‘.viv’: ‘video/vivo’,

‘.vivo’: ‘video/vivo’,

‘.vlc’: ‘audio/x-mpegurl’,

‘.vob’: ‘video/mpeg’,

‘.voc’: ‘audio/x-voc’,

‘.vor’: ‘application/vnd.stardivision.writer’,

‘.vst’: ‘image/x-tga’,

‘.wav’: ‘audio/x-wav’,

‘.wax’: ‘audio/x-ms-asx’,

‘.wb’: ‘application/x-quattropro’,

‘.wb’: ‘application/x-quattropro’,

‘.wb’: ‘application/x-quattropro’,

‘.wbmp’: ‘image/vnd.wap.wbmp’,

‘.wcm’: ‘application/vnd.ms-works’,

‘.wdb’: ‘application/vnd.ms-works’,

‘.webm’: ‘video/webm’,

‘.wk’: ‘application/vnd.lotus—’,

‘.wk’: ‘application/vnd.lotus—’,

‘.wk’: ‘application/vnd.lotus—’,

‘.wks’: ‘application/vnd.ms-works’,

‘.wma’: ‘audio/x-ms-wma’,

‘.wmf’: ‘image/x-wmf’,

‘.wml’: ‘text/vnd.wap.wml’,

‘.wmls’: ‘text/vnd.wap.wmlscript’,

‘.wmv’: ‘video/x-ms-wmv’,

‘.wmx’: ‘audio/x-ms-asx’,

‘.wp’: ‘application/vnd.wordperfect’,

‘.wp’: ‘application/vnd.wordperfect’,

‘.wp’: ‘application/vnd.wordperfect’,

‘.wp’: ‘application/vnd.wordperfect’,

‘.wpd’: ‘application/vnd.wordperfect’,

‘.wpg’: ‘application/x-wpg’,

‘.wpl’: ‘application/vnd.ms-wpl’,

‘.wpp’: ‘application/vnd.wordperfect’,

‘.wps’: ‘application/vnd.ms-works’,

‘.wri’: ‘application/x-mswrite’,

‘.wrl’: ‘model/vrml’,

‘.wv’: ‘audio/x-wavpack’,

‘.wvc’: ‘audio/x-wavpack-correction’,

‘.wvp’: ‘audio/x-wavpack’,

‘.wvx’: ‘audio/x-ms-asx’,

‘.xf’: ‘image/x-sigma-xf’,

‘.xac’: ‘application/x-gnucash’,

‘.xbel’: ‘application/x-xbel’,

‘.xbl’: ‘application/xml’,

‘.xbm’: ‘image/x-xbitmap’,

‘.xcf’: ‘image/x-xcf’,

‘.xcf.bz’: ‘image/x-compressed-xcf’,

‘.xcf.gz’: ‘image/x-compressed-xcf’,

‘.xhtml’: ‘application/xhtml+xml’,

‘.xi’: ‘audio/x-xi’,

‘.xla’: ‘application/vnd.ms-excel’,

‘.xlc’: ‘application/vnd.ms-excel’,

‘.xld’: ‘application/vnd.ms-excel’,

‘.xlf’: ‘application/x-xliff’,

‘.xliff’: ‘application/x-xliff’,

‘.xll’: ‘application/vnd.ms-excel’,

‘.xlm’: ‘application/vnd.ms-excel’,

‘.xls’: ‘application/vnd.ms-excel’,

‘.xlsm’: ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’,

‘.xlsx’: ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’,

‘.xlt’: ‘application/vnd.ms-excel’,

‘.xlw’: ‘application/vnd.ms-excel’,

‘.xm’: ‘audio/x-xm’,

‘.xmf’: ‘audio/x-xmf’,

‘.xmi’: ‘text/x-xmi’,

‘.xml’: ‘application/xml’,

‘.xpm’: ‘image/x-xpixmap’,

‘.xps’: ‘application/vnd.ms-xpsdocument’,

‘.xsl’: ‘application/xml’,

‘.xslfo’: ‘text/x-xslfo’,

‘.xslt’: ‘application/xml’,

‘.xspf’: ‘application/xspf+xml’,

‘.xul’: ‘application/vnd.mozilla.xul+xml’,

‘.xwd’: ‘image/x-xwindowdump’,

‘.xyz’: ‘chemical/x-pdb’,

‘.xz’: ‘application/x-xz’,

‘.wp’: ‘application/wp’,

‘.z’: ‘application/x-compress’,

‘.zabw’: ‘application/x-abiword’,

‘.zip’: ‘application/zip’,

‘.zoo’: ‘application/x-zoo’

原创文章 7 获赞 2 访问量 393

猜你喜欢

转载自blog.csdn.net/bortherLiang/article/details/106144316