PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WEBDEV 2024 → La solution fichier afiche
La solution fichier afiche
Iniciado por APSI, 10,dic. 2004 10:44 - 1 respuesta
Publicado el 10,diciembre 2004 - 10:44
Excuse moi mas la fuction FichierAfficheMIME est une procedure.
qui fait afichier une outre procedure qui detecte toutes les MYME
existant. come ca tu n'aura plus de probleme pour aficher n'iporte quel
fichier

Les deus procedures tu les met un Proc. Global
e dans le code de ton BTN ou Lien met le code suivant.

desoler pour le francais.

//----------Code BTN ou Lien
FichierAfficheMIME(fRepEnCours()+"\CV\"+FicEMPREGO.CV, "", Faux)

//---------------Les procedures

PROCEDURE FichierAfficheMIME(CheminDuFichier, NomAffiché="", bForce=Faux)
// Propose en téléchargement le fichier passé en paramètre avec
// un nom paramètrable.
// Paramètres:
// - CheminDuFichier : chaine contenant le chemin et le nom complet du
fichier à afficher
// - NomAffiché : chaine optionnelle contenant le nom "virtuel" du
fichier définit par l'utilisateur (par défaut
// ce paramètre est identique au nom du fichier + son extension.

NomFic est une chaîne = fExtraitChemin(CheminDuFichier, fFichier)
ExtFic est une chaîne = fExtraitChemin(CheminDuFichier, fExtension)[[2 A]]

SI NomAffiché = "" ALORS
NomAffiché = NomFic + "." + ExtFic
FIN

MIMFic est une chaîne
SI PAS bForce ALORS
MIMFic=TypeMIME(Minuscule(ExtFic)) + RC
SINON
MIMFic="application/unknown" + RC
FIN

MIMDis est une chaîne = "name=""" + NomAffiché + """" + RC ...
+ "Content-Disposition: Attachment;" +...
+ "filename=""" + NomAffiché + """" + RC + EOT

FichierAffiche(CheminDuFichier, MIMFic + MIMDis)



//-------------------------

FONCTION TypeMIME(Extension)
// Renvoie le type MIME associé à une extension donnée
// Paramètres:
// - Extension (obligatoire:oui) : précise l'extension pour laquelle on
souhaite avoir le type MIME
//
// Renvoie:
// - une chaine de caractère contenant le type MIME
//
// Notes:
// Extensions tirées du fichier de configuration MIME.TYPES de Apache 1.3x
//
// Commentaire de l'auteur du fichier:
// This file controls what Internet media types are sent to the client for
// given file extension(s). Sending the correct media type to the client
// is important so they know how to handle the content of the file.
// Extra types can either be added here or by using an AddType directive
// in your config files. For more information about Internet media types,
// please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media
type
// registry is at
<>.

SELON Minuscule(Extension)
CAS "ez" : RENVOYER "application/andrew-inset"
CAS "hqx" : RENVOYER "application/mac-binhex40"
CAS "cpt" : RENVOYER "application/mac-compactpro"
CAS "bin", ...
"dms", ...
"ha", ...
"lzh", ...
"exe", ...
"class" : RENVOYER "application/octet-stream"
CAS "oda" : RENVOYER "application/oda"
CAS "pdf" : RENVOYER "application/pdf"
CAS "ai", ...
"eps", ...
"ps" : RENVOYER "application/postscript"
CAS "smi", ...
"smil" : RENVOYER "application/smil"
CAS "asf" : RENVOYER "application/vnd.ms-asf"
CAS "xls" : RENVOYER "application/vnd.ms-excel"
CAS "ppt" : RENVOYER "application/vnd.ms-powerpoint"
CAS "wks" : RENVOYER "application/vnd.ms-works"
CAS "wbxml" : RENVOYER "application/vnd.wap.wbxml"
CAS "wmlc" : RENVOYER "application/vnd.wap.wmlc"
CAS "wmlsc" : RENVOYER "application/vnd.wap.wmlscriptc"
CAS "bcpio" : RENVOYER "application/x-bcpio"
CAS "vcd" : RENVOYER "application/x-cdlink"
CAS "pgn" : RENVOYER "application/x-chess-pgn"
CAS "cpio" : RENVOYER "application/x-cpio"
CAS "csh" : RENVOYER "application/x-csh"
CAS "dcr", ...
"dir", ...
"dxr" : RENVOYER "application/x-director"
CAS "dvi" : RENVOYER "application/x-dvi"
CAS "spl" : RENVOYER "application/x-futuresplash"
CAS "gtar" : RENVOYER "application/x-gtar"
CAS "gz" : RENVOYER "application/x-gzip"
CAS "hdf" : RENVOYER "application/x-hdf"
CAS "js" : RENVOYER "application/x-javascript"
CAS "skp", ...
"skd", ...
"skt", ...
"skm" : RENVOYER "application/x-koan"
CAS "latex" : RENVOYER "application/x-latex"
CAS "nc cdf" : RENVOYER "application/x-netcdf"
CAS "sh" : RENVOYER "application/x-sh"
CAS "shar" : RENVOYER "application/x-shar"
CAS "swf" : RENVOYER "application/x-shockwave-flash"
CAS "sit" : RENVOYER "application/x-stuffit"
CAS "sv4cpio" : RENVOYER "application/x-sv4cpio"
CAS "sv4crc" : RENVOYER "application/x-sv4crc"
CAS "tar" : RENVOYER "application/x-tar"
CAS "tcl" : RENVOYER "application/x-tcl"
CAS "tex" : RENVOYER "application/x-tex"
CAS "texinfo", ...
"texi" : RENVOYER "application/x-texinfo"
CAS "t", ...
"tr", ...
"roff" : RENVOYER "application/x-troff"
CAS "man" : RENVOYER "application/x-troff-man"
CAS "me" : RENVOYER "application/x-troff-me"
CAS "ms" : RENVOYER "application/x-troff-ms"
CAS "ustar" : RENVOYER "application/x-ustar"
CAS "src" : RENVOYER "application/x-wais-source"
CAS "zip" : RENVOYER "application/zip"
CAS "au", ...
"snd" : RENVOYER "audio/basic"
CAS "mid", ...
"midi", ...
"kar" : RENVOYER "audio/midi"
CAS "mpga", ...
"mp2", ...
"mp3" : RENVOYER "audio/mpeg"
CAS "aif", ...
"aiff", ...
"aifc" : RENVOYER "audio/x-aiff"
CAS "ram", ...
"rm" : RENVOYER "audio/x-pn-real""audio"
CAS "rpm" : RENVOYER "audio/x-pn-real""audio-plugin"
CAS "ra" : RENVOYER "audio/x-real""audio"
CAS "wav" : RENVOYER "audio/x-wav"
CAS "pdb", ...
"xyz" : RENVOYER "chemical/x-pdb"
CAS "bmp" : RENVOYER "image/bmp"
CAS "cgm" : RENVOYER "image/cgm"
CAS "gif" : RENVOYER "image/gif"
CAS "ief" : RENVOYER "image/ief"
CAS "jpeg", ...
"jpg", ...
"jpe" : RENVOYER "image/jpeg"
CAS "png" : RENVOYER "image/png"
CAS "tiff", ...
"tif" : RENVOYER "image/tiff"
CAS "wbmp" : RENVOYER "image/vnd.wap.wbmp"
CAS "ras" : RENVOYER "image/x-cmu-raster"
CAS "pnm" : RENVOYER "image/x-portable-anymap"
CAS "pbm" : RENVOYER "image/x-portable-bitmap"
CAS "pgm" : RENVOYER "image/x-portable-graymap"
CAS "ppm" : RENVOYER "image/x-portable-pixmap"
CAS "rgb" : RENVOYER "image/x-rgb"
CAS "xbm" : RENVOYER "image/x-xbitmap"
CAS "xpm" : RENVOYER "image/x-xpixmap"
CAS "xwd" : RENVOYER "image/x-xwindowdump"
CAS "eml" : RENVOYER "message/rfc822"
CAS "igs", ...
"iges" : RENVOYER "model/iges"
CAS "msh", ...
"mesh", ...
"silo" : RENVOYER "model/mesh"
CAS "wrl", ...
"vrml" : RENVOYER "model/vrml"
CAS "css" : RENVOYER "text/css"
CAS "html", ...
"htm" : RENVOYER "text/html"
CAS "asc", ...
"txt" : RENVOYER "text/plain"
CAS "rtx" : RENVOYER "text/rich""text"
CAS "rtf" : RENVOYER "text/rtf"
CAS "sgml", ...
"sgm" : RENVOYER "text/sgml"
CAS "tsv" : RENVOYER "text/tab-separated-values"
CAS "wml" : RENVOYER "text/vnd.wap.wml"
CAS "wmls" : RENVOYER "text/vnd.wap.wmlscript"
CAS "etx" : RENVOYER "text/x-se""text"
CAS "xml" : RENVOYER "text/xml"
CAS "mpeg", ...
"mpg", ...
"mpe" : RENVOYER "video/mpeg"
CAS "divx", ...
"dvx" : RENVOYER "video/divx"
CAS "qt", ...
"mov" : RENVOYER "video/quicktime"
CAS "avi" : RENVOYER "video/x-ms""video"
CAS "movie" : RENVOYER "video/x-sgi-movie"
CAS "ice" : RENVOYER "x-conference/x-cooltalk"
AUTRES CAS
RENVOYER "application/octet-stream"
FIN


--
APSI -
Braga - Portugal
Publicado el 12,diciembre 2004 - 14:42
Bonjour,

Je viens de tester cette solution qui me parait très bien.
Elle marche très bien... en local uniquement !
En effet, dès que je teste depuis internet, le fichier s'ouvre mais en
format texte (que ce soit une image, un doc word, excel, vidéo...).

Quelqu'un aurait-il une explication à cela ?

Merci.

Clément