/home/mjc1/public_html/manage/DownLoad.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?

@extract($_REQUEST);

if(
$type == "as"){

        
$now_filename explode("."$filename);
      
$newFile      explode("_" $now_filename[0]);

            
$ch_file "../save_dir/as/".$filename;
            if(
file_exists($ch_file)){
        
            }else{ echo(
"<script> alert('ÆÄÀÏÀÌ µî·Ï µÇÁö ¾Ê¾Ò½À´Ï´Ù..');</script>");}
    
    if(
$newFile[1]){
        
        
$newFilename    =    $newFile[0] . "." $now_filename[1];
        
$newFile_Name   =    "../save_dir/as/tmp/" $newFilename;
        
$tmpFile        =    "../save_dir/as/" $filename;

        if(!
copy($tmpFile,$newFile_Name)){
            
$msg "filed";
            echo (
"
                <script language='javascript'>
                <!--
                    alert ('
$msg');
                
                //-->
                </script>
            "
);
        
        }
            
            
$filename $newFilename;
            
$path "../save_dir/as/tmp";
            
$delfile $path "/" $filename;
        
    } else {
        
$path "../save_dir/as";
    }
    
}


$filename trim($filename);
    
$file "$path/$filename";
    if(
file_exists($file)){}else{ echo("<script> alert('ÆÄÀÏÀÌ µî·Ï µÇÁö ¾Ê¾Ò½À´Ï´Ù..');history.back();</script>");}

    
$file_size filesize($file);
if(
eregi("(MSIE 5.5 | MSIE 6.0)"$HTTP_USER_AGENT)) {
        
header("Content-Type: application/octet-stream");
        
header("Content-Disposition: attachment;filename=$filename");
        
header("Content-Transfer-Encoding: binary");
        
header("Pragma: no-cache");
        
header("Expires: 0");
        
Header("Content-Length: $file_size");
        
Header("---");
    } else {
        
Header("Content-type: file/unknown");
        
Header("Content-Disposition: attachment; filename=$filename");
        
Header("Content-Description: PHP Generated Data");
        
header("Pragma: no-cache");
        
header("Expires: 0");
        
Header("Content-Length:$file_size");

    }

if (
is_file($file)) {
        
$fp fopen($file,"r");
        if(!
fpassthru($fp)) {
            
fclose($fp);
        }
    }

if(
$delfile){
    if(!
unlink($delfile)){    }        
        
}
?>