User Tools

Site Tools


uphp:functions:ftp_open

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:ftp_open [2019/06/29 06:59]
admin
uphp:functions:ftp_open [2020/05/06 04:09]
admin
Line 24: Line 24:
 <span style="color:green">int <span style="color:green">int
 <span style="color:blue">$secure <span style="color:blue">$secure
-<span style="color:black">])+<span style="color:black">] 
 +<span style="color:black">[, 
 +<span style="color:green">int 
 +<span style="color:blue">$use_keepalive 
 +<span style="color:black">
 +<span style="color:black">[, 
 +<span style="color:green">int 
 +<span style="color:blue">$ignore_response 
 +<span style="color:black">
 +)
 </html></well> </html></well>
  
Line 40: Line 49:
  
 <html><b><span style="color:blue">$secure<span style="color:black"></b>:  <b><span style="color:green">Int<span style="color:black"></b> whether to use TLS (1) or not (0)</html> <html><b><span style="color:blue">$secure<span style="color:black"></b>:  <b><span style="color:green">Int<span style="color:black"></b> whether to use TLS (1) or not (0)</html>
 +
 +<html><b><span style="color:blue">$use_keepalive<span style="color:black"></b>:  <b><span style="color:green">Int<span style="color:black"></b> whether to send keepalive messages or not (1=yes) [only on FW > x.1169]</html>
 +
 +<html><b><span style="color:blue">$ignore_reponse<span style="color:black"></b>:  <b><span style="color:green">Int<span style="color:black"></b> set to 1 if your FTP uploads are not completing properly, this will not wait for the 226 response confirmation but instead close the connection once the data socket has finished sending data to the server. [only on FW > x.1169]</html>
  
 ====Return Values==== ====Return Values====
Line 45: Line 58:
 <html><b><span style="color:green">int<span style="color:black"></b></html>:  Returns 1 if FTP connection was successful and 0 if it failed. <html><b><span style="color:green">int<span style="color:black"></b></html>:  Returns 1 if FTP connection was successful and 0 if it failed.
  
-====Example====+====Example 1====
  
 <code php> <code php>
Line 57: Line 70:
 </code> </code>
  
 +====Example 2====
 +Upload a file to the server but don't wait for the response
 +<code php>
 +<?
 +        // set folder path here
 +        $folder_path = "/web/";
 +        
 + $res = ftp_open("ftp.myserver.com",21,"myuser","mypassword",0,1,1);
 + if ($res) {
 +            print("connected to FTP server!!");
 +            $res=ftp_command("cwd ".$folder_path);
 +            // upload the file
 +            $res=ftp_upload("server_filename.txt","/logs/local_filename.txt",0,1);
 +            if ($res==1) {
 +                print("File uploaded successfully");
 +            } else {
 +                print("Error uploading the file");
 +            }
 +            ftp_close();
 + }
 +
 +?>
 +</code>
 ====See Also==== ====See Also====
  
uphp/functions/ftp_open.txt · Last modified: 2021/09/13 05:57 (external edit)