Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Dropbox Upload
#6

When I call function for file uploading in dropbox I getting error:

Message: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead

Part of code for curl from library is:

PHP Code:
private function _connect($url$header$request$postdata false$destination false)
    {
        
$ch curl_init($url);
        
curl_setopt($chCURLOPT_HTTPAUTHCURLAUTH_BASIC ) ;
        
curl_setopt($chCURLOPT_SSLVERSION1); // Require TLS
        
curl_setopt($chCURLOPT_SSL_VERIFYPEERtrue);
        
curl_setopt($chCURLOPT_SSL_VERIFYHOST2);
        
curl_setopt($chCURLOPT_CAINFO__DIR__."/certs/trusted-certs.crt");
        
curl_setopt($chCURLOPT_CAPATH__DIR__."/certs/");
        
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
        
curl_setopt($chCURLOPT_CUSTOMREQUEST$request);
        
curl_setopt($chCURLOPT_HTTPHEADERexplode(self::LINE_END$header));
        
curl_setopt($chCURLINFO_HEADER_OUTtrue);

        if(
is_array($postdata))
        {
            
curl_setopt($chCURLOPT_POSTtrue);
            
curl_setopt($chCURLOPT_POSTFIELDS$postdata);
        }
       
        
$response curl_exec($ch);
       
        if(
self::DEBUG)
        {
            
error_log(print_r(curl_getinfo($ch), true));
            
error_log($response);
        }
       
        
$code curl_getinfo($chCURLINFO_HTTP_CODE);
        
curl_close($ch);
       
        
//If this is a content request write the file
        
if($destination !== false)
        {
            
//If the response was good then write
            //the file and return true
            
if($code == '200')
            {
                
$fh fopen($destination'w');
                
fwrite($fh$response);
                if(
$fh !== false)
                {
                    
fclose($fh);
                    return 
true;
                }
            }
            
//The response was bad or the file couldn't
            //be written so return false.
            
return false;
        }
        else return 
$response;
    } 

Any ideas?
Reply


Messages In This Thread
Codeigniter Dropbox Upload - by vladakg - 02-02-2016, 11:09 AM
RE: Codeigniter Dropbox Upload - by vladakg - 02-03-2016, 12:50 PM
RE: Codeigniter Dropbox Upload - by vladakg - 02-03-2016, 02:41 PM
RE: Codeigniter Dropbox Upload - by Diederik - 02-03-2016, 03:05 PM
RE: Codeigniter Dropbox Upload - by vladakg - 02-04-2016, 09:15 AM
RE: Codeigniter Dropbox Upload - by vladakg - 02-04-2016, 02:41 PM
RE: Codeigniter Dropbox Upload - by vladakg - 02-05-2016, 01:15 PM
RE: Codeigniter Dropbox Upload - by vladakg - 02-06-2016, 03:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB