Project

General

Profile

Statistics
| Branch: | Revision:

colonymech / docs / www / colonyscout / internal / uploadify / uploadify / upload copy.php @ f59acf11

History | View | Annotate | Download (1.6 KB)

1
<?php
2
// JQuery File Upload Plugin v1.4.1 by RonnieSan - (C)2009 Ronnie Garcia
3
if (!empty($_FILES)) {
4
        $tempFile = $_FILES['Filedata']['tmp_name'];
5
        $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
6
        $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
7
        
8
        // Uncomment the following line if you want to make the directory if it doesn't exist
9
        // mkdir(str_replace('//','/',$targetPath), 0755, true);
10
        
11
        move_uploaded_file($tempFile,$targetFile);
12
}
13

    
14
                          switch ($_FILES['Filedata']['error'])
15
                                {          case 0:
16
                                                $msg = "No Error";
17
                                                break;
18
                                        case 1:
19
                                           $msg = "The file is bigger than this PHP installation allows";
20
                                           break;
21
                                           case 2:
22
                                           $msg = "The file is bigger than this form allows";
23
                                           break;
24
                                    case 3:
25
                                           $msg = "Only part of the file was uploaded";
26
                                           break;
27
                                    case 4:
28
                                           $msg = "No file was uploaded";
29
                                           break;
30
                                        case 6:
31
                                           $msg = "Missing a temporary folder";
32
                                           break;
33
                                    case 7:
34
                                           $msg = "Failed to write file to disk";
35
                                           break;
36
                                    case 8:
37
                                           $msg = "File upload stopped by extension";
38
                                           break;
39
                                         default:
40
                                                $msg = "unknown error ".$_FILES['Filedata']['error'];
41
                                                break;
42
                                }
43

    
44
        $setupFile = "uploadVARresults.txt";
45
        $fh = fopen($setupFile, 'w');
46
        if ($fh) {
47
                $stringData = "path: ".$_GET['folder']."\n targetFile: ".$targetFile."\n Error: ".$_FILES['Filedata']['error']."\nError Info: ".$msg;
48
        }
49
        fwrite($fh, $stringData);
50
        fclose($fh);
51
        
52
        echo '1';
53

    
54
?>