title: How can I open image file with fopen function in FTP Server in php
body: <pre><code>$conn = ftp_connect("ftp.mywebsite.com") or die("Could not connect");
  ftp_login($conn,"admin","password");
  $self = $_SERVER['PHP_SELF'];
  $file = $_FILES["file"]["name"];
  if ($_FILES['file']['error'] !== UPLOAD_ERR_OK) 
  { 
     die("Upload failed"); 
  }
  else
  { 
     $fp = fopen($file, 'r')or die("Unable to open $file for reading");
  
    if(ftp_fput($conn, $file,$fp, FTP_BINARY))
    {
       echo "success";  
    } 
    else 
    {  
       echo "error"; 
    } 
  }
  </code></pre>
  
  <p>How can I open image file with fopen function in FTP Server in php. (failed to open stream: No such file or directory )</p>