Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. while($row = mysqli_fetch_array($rst))
  2. {
  3. //creating excel file here
  4.  
  5.  
  6. $passwordFTP = "password";
  7. $userFTP = "user";
  8. $hostFTP = "host";
  9.  
  10. $i = 0;$test = 0;
  11. while($i < 3 && $test == 0)
  12. {
  13. $i++;
  14. try
  15. {
  16. $conn_id = ftp_connect($hostFTP);
  17. $login_result = ftp_login($conn_id, $userFTP, $passwordFTP);
  18. // turn passive mode on
  19. ftp_pasv($conn_id, true);
  20.  
  21. if(ftp_put($conn_id, $output_filename, $path.$output_filename, FTP_BINARY))
  22. {
  23. $log = new Logs("listes.log", "Uploaded $output_filename");
  24. $test = 1;
  25. }
  26. else
  27. {
  28. $log = new Logs("listes.log", "($i)FAIL Uploading $output_filename");
  29. }
  30. ftp_close($conn_id);
  31.  
  32. }
  33. catch (Exception $e)
  34. {
  35. $log = new Logs("listes.log", "($i)There was a problem while uploading $output_filename");
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement