Beispiel #1
0
 function ServerSend()
 {
     $file = gp('gpfile');
     $parms = "?gp_uid=" . SessionGet('remoteUID') . "&gp_pwd=" . SessionGet('remotePWD') . "&gp_page=a_codexfer" . "&gp_app=" . trim($this->row['application']) . "&gp_action=servsend" . "&gpfile=" . urlencode($file);
     // Setup the file transfer
     $postData = array();
     //simulates <input type="file" name="file_name">
     $dir = appDir($this->row['application']);
     $postData['file_name'] = "@" . $dir . $file;
     $postData['submit'] = "UPLOAD";
     $url = $this->node['node_url'];
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "http://{$url}/andro/{$parms}");
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
     $retval = curl_exec($ch);
     curl_close($ch);
     // Process Results
     if ($retval == '1') {
         $d1 = AppDir($this->row['application']);
         $d2 = $d1 . '/ref/';
         fsMakeDirNested($d2, dirname($file));
         copy($d1 . $file, $d2 . $file);
     } else {
         ErrorAdd($retval);
     }
 }
Beispiel #2
0
 function ServSend()
 {
     if (count($_FILES) == 0) {
         echo "Server reports: No file was received, unknown error.";
         return;
     }
     $dir = AppDir(gp('gp_app'));
     $gpfile = gp('gpfile');
     if (file_exists($dir . $gpfile)) {
         echo "File {$dir}{$gpfile} already exists on server, please refresh your reference files";
         return;
     }
     fsMakeDirNested($dir, dirname($gpfile));
     ob_start();
     $noecho = move_uploaded_file($_FILES['file_name']['tmp_name'], $dir . $gpfile);
     return '';
 }