down_file($array_info['fileUp']); }else{ $url = "http://".$array_info['server'].$array_info['path'].$array_info['filePhp'].$base64; header("Location:" . $url); } } function down_file($file) { ini_set("session.save_path","/php_sessions"); $size = filesize(ini_get("session.save_path").'/'. $file); $NameFile = explode("_IM_SendFile_",$file); if (!empty($file)) { if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) $UserBrowser = "Opera"; elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) $UserBrowser = "IE"; else $UserBrowser = ''; $strFileType = strrev(substr(strrev($NameFile),0,4)); $ContentType = "application/octet-stream"; if ($strFileType == ".asf") $ContentType = "video/x-ms-asf"; if ($strFileType == ".avi") $ContentType = "video/avi"; if ($strFileType == ".doc") $ContentType = "application/msword"; if ($strFileType == ".zip") $ContentType = "application/zip"; if ($strFileType == ".xls") $ContentType = "application/vnd.ms-excel"; if ($strFileType == ".gif") $ContentType = "image/gif"; if ($strFileType == ".jpg" || $strFileType == "jpeg") $ContentType = "image/jpeg"; if ($strFileType == ".wav") $ContentType = "audio/wav"; if ($strFileType == ".mp3") $ContentType = "audio/mpeg3"; if ($strFileType == ".mpg" || $strFileType == "mpeg") $ContentType = "video/mpeg"; if ($strFileType == ".rtf") $ContentType = "application/rtf"; if ($strFileType == ".htm" || $strFileType == "html") $ContentType = "text/html"; if ($strFileType == ".xml") $ContentType = "text/xml"; if ($strFileType == ".xsl") $ContentType = "text/xsl"; if ($strFileType == ".css") $ContentType = "text/css"; if ($strFileType == ".php") $ContentType = "text/php"; if ($strFileType == ".asp") $ContentType = "text/asp"; if ($strFileType == ".pdf") $ContentType = "application/pdf"; if ($strFileType == ".txt") $ContentType = "text/plain"; if ($strFileType == ".log") $ContentType = "text/plain"; if ($strFileType == ".wmv") $ContentType = "video/x-ms-wmv"; if ($strFileType == ".sxc") $ContentType = "application/vnd.sun.xml.calc"; if ($strFileType == ".odt") $ContentType = "application/vnd.oasis.opendocument.text"; if ($strFileType == ".stc") $ContentType = "application/vnd.sun.xml.calc.template"; if ($strFileType == ".sxd") $ContentType = "application/vnd.sun.xml.draw"; if ($strFileType == ".std") $ContentType = "application/vnd.sun.xml.draw.template"; if ($strFileType == ".sxi") $ContentType = "application/vnd.sun.xml.impress"; if ($strFileType == ".sti") $ContentType = "application/vnd.sun.xml.impress.template"; if ($strFileType == ".sxm") $ContentType = "application/vnd.sun.xml.math"; if ($strFileType == ".sxw") $ContentType = "application/vnd.sun.xml.writer"; if ($strFileType == ".sxq") $ContentType = "application/vnd.sun.xml.writer.global"; if ($strFileType == ".stw") $ContentType = "application/vnd.sun.xml.writer.template"; if ($strFileType == ".ps") $ContentType = "application/postscript"; if ($strFileType == ".pps") $ContentType = "application/vnd.ms-powerpoint"; if ($strFileType == ".odt") $ContentType = "application/vnd.oasis.opendocument.text"; if ($strFileType == ".ott") $ContentType = "application/vnd.oasis.opendocument.text-template"; if ($strFileType == ".oth") $ContentType = "application/vnd.oasis.opendocument.text-web"; if ($strFileType == ".odm") $ContentType = "application/vnd.oasis.opendocument.text-master"; if ($strFileType == ".odg") $ContentType = "application/vnd.oasis.opendocument.graphics"; if ($strFileType == ".otg") $ContentType = "application/vnd.oasis.opendocument.graphics-template"; if ($strFileType == ".odp") $ContentType = "application/vnd.oasis.opendocument.presentation"; if ($strFileType == ".otp") $ContentType = "application/vnd.oasis.opendocument.presentation-template"; if ($strFileType == ".ods") $ContentType = "application/vnd.oasis.opendocument.spreadsheet"; if ($strFileType == ".ots") $ContentType = "application/vnd.oasis.opendocument.spreadsheet-template"; if ($strFileType == ".odc") $ContentType = "application/vnd.oasis.opendocument.chart"; if ($strFileType == ".odf") $ContentType = "application/vnd.oasis.opendocument.formula"; if ($strFileType == ".odi") $ContentType = "application/vnd.oasis.opendocument.image"; if ($strFileType == ".ndl") $ContentType = "application/vnd.lotus-notes"; $mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream'; header("Content-Type: $ContentType"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); header("Expires: 0"); header("Content-Disposition: attachment; filename=\"" . $NameFile[1] . "\""); header("Content-length: " . $size); readfile(ini_get("session.save_path") . "/" . $file); die(); } } } if(isset ($_REQUEST['file'])){ $obj_down = new download(); $obj_down->Decode_String($_REQUEST['file']); } ?>