Please wait. Loading
Sometimes necessary to enable the user to download the file without giving the real path to this file.
To do this means we read this php file into a variable which is displayed in the browser with the title of the attached file attachment.
The following code allows you to open or save a file in a format mp3, what is specified in the header Content-type: audio/mpeg.
$track = "1.mp3"; header("Content-type: audio/mpeg"); header("Content-length: ".filesize($track)); header("Content-Disposition: attachment; filename=1.mp3"); $data=readfile($track); echo $data;
Other MIME-types can be found in the following table:
MIME Type Extension animation/narrative nml application/activemessage application/andrew-inset application/applefile application/atomicmail application/dca-rft application/dec-dx application/dsptype tsp application/fastman lcc application/font-tdpfr pfr application/futuresplash spl application/mac-binhex40 hqx application/mac-compactpro cpt application/macwriteii application/mspowerpoint pot pps ppt ppz application/msword application/news-message-id application/news-transmission application/octet-stream bin class dms exe sea application/oda oda application/pdf pdf application/postscript ai eps ps application/remote-printing application/rtf rtf application/slate application/softvision svi application/wita application/wordperfect5.1 application/x-authorware-bin aab application/x-authorware-map aam application/x-authorware-seg aas application/x-bcpio bcpio application/x-bzip2 bz2 application/x-calquick cqk application/x-cdlink vcd application/x-cocoa cco application/x-compress Z application/x-cpio cpio application/x-csh csh application/x-director dcr dir dxr application/x-dvi dvi application/x-excel xls application/x-expandedbook ebk application/x-gtar gtar application/x-gzip gz application/x-hdf hdf application/x-httpd-cgi cgi application/x-javascript js ls mocha application/x-koan skd skm skp skt application/x-latex latex application/x-lzh lha lzh application/x-mapserver mps application/x-mascot mct application/x-mif mif application/x-netcdf cdf nc application/x-ns-proxy-auto-config pac application/x-pixelscooter mpp application/x-pointplus css application/x-sh sh application/x-shar shar application/x-shockwave-flash swf application/x-sprite spr sprite application/x-spt spt application/x-stuffit sit application/x-sv4cpio sv4cpio application/x-sv4crc sv4crc application/x-tar tar tgz application/x-tcl tcl application/x-tex tex application/x-texinfo texi texinfo application/x-troff roff t tr application/x-troff-man man application/x-troff-me me application/x-troff-ms ms application/x-ustar ustar application/x-wais-source src application/x-xdma xdm xdma application/zip zip audio/basic au snd audio/echospeech es audio/midi kar mid midi audio/mpeg mp2 mp3 mpga audio/tsplayer tsi audio/voxware vox audio/x-aiff aif aifc aiff audio/x-bamba aba audio/x-chacha cha audio/x-mio mio audio/x-pn-realaudio ra ram rm audio/x-pn-realaudio-plugin rpm audio/x-twinvq vqf vql audio/x-twinvq-plugin vqe audio/x-wav wav chemical/x-csml csm chemical/x-embl-dl-nucleotide emb chemical/x-gaussian-input gau chemical/x-mdl-molfile mol chemical/x-mopac-input mop chemical/x-pdb pdb chemical/x-xyz xyz i-world/i-vrml ivr image/fif fif image/gif gif image/ief ief image/jpeg jpe jpeg jpg image/png png image/tiff tif tiff image/vasa mcf image/x-cmu-raster ras image/x-freehand fh fh4 fh5 fh7 fhc image/x-jps jps image/x-portable-anymap pnm image/x-portable-bitmap pbm image/x-portable-graymap pgm image/x-portable-pixmap ppm image/x-rgb rgb image/x-xbitmap xbm image/x-xpixmap xpm image/x-xres swx image/x-xwindowdump xwd message/external-body message/news message/partial message/rfc822 multipart/alternative multipart/appledouble multipart/digest multipart/mixed multipart/parallel plugin/listenup ptlk plugin/wanimate waf wan text/html htm html text/plain txt text/richtext rtx text/tab-separated-values tsv text/x-setext etx text/x-sgml sgm sgml text/x-speech talk text/x-vcard vcf video/mpeg mpe mpeg mpg video/quicktime mov qt video/vnd.vivo viv vivo video/x-bamba vba video/x-msvideo avi video/x-sgi-movie movie video/x-tango tgo video/x-vif vif workbook/formulaone vts world/x-panoramix pan x-conference/x-cooltalk ice x-world/x-d96 d96 mus x-world/x-svr svr x-world/x-vrml vrml wrl x-world/x-vrt vrt
Back to list
©2012 ArtistSoft - Software Development Company. All rights reserved.
Cherkasy: +38 (063) 841-89-65 Kherson: +38 (050) 390-58-02
Our prices
Information site
200$
Internet representation
400$
Corporate Site
600$
Online shop
800$
Site Promotion
Corporate Identity
100$
Placement site (hosting) for one year
30$