Subversion Repositories computer_asset_manager_v1

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php
54 rodolico 2
   include_once( '../../header.php' );
3
   include_once( './functions.php' );
4
 
5
   $result = '';
6
   if ( isset( $_REQUEST['uploaddocument'] ) ) {
7
      $client_id = isset( $_REQUEST['client_id'] ) ? $_REQUEST['client_id'] : '';
8
      $site_id = isset( $_REQUEST['site_id'] ) ? $_REQUEST['site_id'] : '';
9
      $device_id = isset( $_REQUEST['device_id'] ) ? $_REQUEST['device_id'] : '';
10
      $result = makeFileName( 
11
            $_FILES['fileToUpload']['name'], 
12
            $device_id, 
13
            $client_id, 
14
            $site_id 
15
            );
16
      if ( $result['valid'] ) {
17
         $nameOnDisk = $result['filename'];
18
         makePath( $nameOnDisk );
19
         $result = "<br />$nameOnDisk";
20
         /*
21
          * if ( makePath( $nameOnDisk ) ) {
22
            $result = 'Path Made - ';
23
         } else {
24
            $result = 'failed to make path - ';
25
         }
26
         $result .= $nameOnDisk;
27
         $path = $_SERVER['DOCUMENT_ROOT'] . '/' . pathinfo( $nameOnDisk, PATHINFO_DIRNAME );
28
         $result .= $path;
29
         /*
30
         if ( ( move_uploaded_file( $_FILES["fileToUpload"]["tmp_name"], $nameOnDisk ) ) ) {
31
            $result = addDocument(
32
                           $nameOnDisk,
33
                           $device_id, 
34
                           $client_id, 
35
                           $site_id,
36
                           isset( $_REQUEST['mime_type'] ) ? $_REQUEST['mime_type'] : $_FILES["fileToUpload"]['type'],
37
                           isset( $_REQUEST['name'] ) ? $_REQUEST['name'] : $_FILES['fileToUpload']['name'],
38
                           $_REQUEST['description']
39
                        );
40
            $result = $result === null ? 'Could not add document to database' : 'Success';
41
         } else {
42
            $result = 'Failed to upload to disk';
43
         } // if move_uploaded_file .. else
44
         */
45
      } else {
46
         $result = $result['message'];
47
      } // if nameOnDisk .. else
48
   } // if isset uploaddocument
1 rodolico 49
?>
50
<?xml version="1.0" encoding="utf-8"?>
51
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
52
<html xmlns="http://www.w3.org/1999/xhtml">
53
<head>
54
  <title>Daily Data - Computer Asset Management Program</title>
55
  <link rel="stylesheet" type="text/css" href="../../camp.css">
56
</head>
57
<body>
58
<?php include_once('../../menu.php'); ?>
59
<div id="content">
54 rodolico 60
   <?php if ( isset( $result ) ) print "<h3>$result</h3>"; ?>
61
   <p>Choose only <b>one</b> of device, site or client to add the document to</p>
1 rodolico 62
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
63
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
64
    <table>
65
       <tr>
66
          <td>
67
             Attach To Device
68
          </td>
69
          <td>
54 rodolico 70
             <select name='device_id' >
1 rodolico 71
                <option value='0'>------------</option>
54 rodolico 72
                <?php print queryToSelect('select device_id, Device from view_current_client_systems order by Device' ); ?>
1 rodolico 73
             </select>
74
          </td>
75
       </tr>
76
       <tr>
77
          <td>
78
             Attach To Site
79
          </td>
80
          <td>
54 rodolico 81
             <select name='site_id' >
1 rodolico 82
                <option value='0'>------------</option>
54 rodolico 83
                <?php print queryToSelect('select site_id, name from view_current_client_site order by name' ); ?>
1 rodolico 84
             </select>
85
          </td>
86
       </tr>
87
       <tr>
88
          <td>
89
             Attach To Client
90
          </td>
91
          <td>
54 rodolico 92
             <select name='client_id' >
1 rodolico 93
                <option value='0'>------------</option>
54 rodolico 94
                <?php print queryToSelect('select client_id, name from view_current_client order by name' ); ?>
1 rodolico 95
             </select>
96
          </td>
97
       </tr>
98
       <tr>
99
          <td>
100
             Mime Type
101
          </td>
102
          <td>
103
             <select name='mime_type' >
54 rodolico 104
                <option value='0'>Autodetect</option>
105
                <?php print queryToSelect("select document_mime_type_id, concat( extension, ' (', mime_type, ')') from document_mime_type order by extension" ); ?>
1 rodolico 106
             </select>
107
          </td>
108
       </tr>
109
       <tr>
110
          <td>
111
             Document Name
112
          </td>
113
          <td>
114
             <input type="text" name="name" size="30" maxlength="64" />
115
          </td>
116
       </tr>
117
       <tr>
118
          <td>
119
             Description
120
          </td>
121
          <td>
122
             <input type="text" name="description" size="30" />
123
          </td>
124
       </tr>
125
       <tr>
126
          <td>
127
             Choose File
128
          </td>
129
          <td>
54 rodolico 130
             <input name="fileToUpload" type="file" />
1 rodolico 131
          </td>
132
       </tr>
133
       <tr>
134
          <td colspan='2' align="center">
135
             <input type="submit" name="uploaddocument" value="Upload" />
136
          </td>
137
       </tr>
138
    </table>
139
  </form>
140
</div>
141
 
142
</body>
143
</html>
144