Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 class FileToSend
00027 {
00028
00029
00030
00031 var $filename;
00032
00033
00034
00035 var $type;
00036
00037
00038
00039 var $path;
00040
00041
00042
00043 var $full_name;
00044 function __construct($p_filename,$p_type="")
00045 {
00046 $this->full_name=$p_filename;
00047 if (strpos($p_filename,'/') != false)
00048 {
00049 $this->path=dirname($p_filename);
00050 }
00051 $this->filename=basename ($p_filename);
00052 if ( $p_type=="")
00053 {
00054 $this->guess_type();
00055
00056 }
00057 }
00058
00059
00060
00061 private function guess_type()
00062 {
00063 $ext_pos= strrpos($this->filename,'.');
00064 if ( $ext_pos == false ) {
00065 $this->type="application/octect";
00066 return;
00067 }
00068 $ext= substr($this->filename, $ext_pos+1, 3);
00069 switch ($ext)
00070 {
00071 case 'odt':
00072 $this->type='application/vnd.oasis.opendocument.text';
00073 break;
00074 case 'ods':
00075 $this->type='application/vnd.oasis.opendocument.spreadsheet';
00076 break;
00077 case 'pdf':
00078 $this->type="application/pdf";
00079 break;
00080 case 'zip':
00081 $this->type="application/zip";
00082 break;
00083 default:
00084 $this->type="application/octet";
00085 }
00086
00087 }
00088
00089
00090
00091 function compute_name($p_filename)
00092 {
00093
00094
00095
00096 }
00097
00098 }