Code type module improvements:
[openemr.git] / library / upload.inc
blob650dc194931631636c4bd3b682001f731c414aff
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function send_file ($fp,$size)
6         global $billing_server;
7         global $billing_user;
8         global $billing_pass;
10         if ($billing_server == "" || $billing_user == "" || $billing_pass == "") {
11                 
12                 include_once("{$GLOBALS["srcdir"]}/need_service.inc");
14                 return FALSE;
15         }
17         $url = "$billing_server/~$billing_user/";
19         return actually_send_file($fp,$size,$url,$billing_user,$billing_pass);
22 function actually_send_file ($fp, $size, $url, $user, $pass)
25         $filename = date("Y-m-d-G:i:s");
27         $ch = curl_init();
28         curl_setopt ($ch, CURLOPT_URL, $url.$filename);
29         curl_setopt ($ch, CURLOPT_SSLVERSION, 3);
30         curl_setopt ($ch, CURLOPT_UPLOAD, 1);
31         curl_setopt ($ch, CURLOPT_PUT, 1);
32         curl_setopt ($ch, CURLOPT_FAILONERROR, 1);
33         curl_setopt ($ch, CURLOPT_INFILE, $fp);
34         curl_setopt ($ch, CURLOPT_INFILESIZE, $size);
35         curl_setopt ($ch, CURLOPT_USERPWD, "$user:$pass");
36         curl_setopt ($ch, CURLOPT_MUTE, 0);
37         echo "<!--\n";
38         $ret = curl_exec ($ch);
39         curl_close($ch);
40         echo "-->\n";
42         return $ret;