Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] polaczenie ftp przez php
macza
post
Post #1





Grupa: Zarejestrowani
Postów: 236
Pomógł: 4
Dołączył: 1.05.2006
Skąd: Lublin

Ostrzeżenie: (0%)
-----


Witam, mam taki oto skrypt:
  1. <?php
  2. // define some constants
  3.  $ftpserver = &#8220;ftp.boo.pl”;
  4.  $ftpdirectory = &#8220;/public_html”;
  5.  $download = &#8220;somefile-0.1.tar.gz”;
  6.  $tempfile = tempnam(&#8220;/tmp”, “ftp”);
  7.  $destdir = &#8220;/downloads”;
  8.  if (!($ftp = ftp_connect($ftpserver))) { print(&#8220;Unable to connect to $ftpserver!<br>n”); exit();
  9.  }
  10.  print(&#8220;Connected to $ftpserver…<br>n”);
  11.  if (!ftp_login($ftp, &#8220;anonymous”, “someone@somehost.com”)) { print(“Unable to login.<br>n”); exit();
  12.  }
  13.  print(&#8220;Logged in.<br>n”);
  14.  ftp_pasv($ftp, FALSE);
  15.  if(!ftp_chdir($ftp, $ftpdirectory)) { print(&#8220;Unable to change directory to $ftpdirectory!<br>n”); exit();
  16.  }
  17.  $fp = fopen($tempfile, &#8216;w’);
  18.  if(!ftp_fget($ftp, $fp, $download, FTP_IMAGE)) { print(&#8220;Unable to download file $download!<br>n”); exit();
  19.  }
  20.  fclose($ftp);
  21.  ftp_quit($ftp);
  22.  if(!rename($tempfile, $destdir . &#8220;/” . $download)) { print(“Unable to move file to destination directory!<br>n”); exit();
  23.  }
  24.  print(&#8220;File $download successfully downloaded.<br>n”);
  25. ?>

ok skrypt loguje sie i pisze takie cos:
Warning: fclose(): supplied resource is not a valid stream resource in /home/accounts_m/macza/public_html/_/ftp.php on line 28

Warning: rename(): open_basedir restriction in effect. File(/_/index.php) is not within the allowed path(s): (/home/accounts_m/macza:/tmp) in /home/accounts_m/macza/public_html/_/ftp.php on line 30
Unable to move file to destination directory!

co mam zrobic zeby zgrywalo mi to? please pomóżcie! ;p
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 03:51