开发者

ftp php file uploadin

<?php
   ini_set('max_execution_time', '0');

   $开发者_高级运维host = '234.546.155.485';
   $usr = 'fgfgfgdf';
   $pwd = 'fghghh';

   // file to move:
   $file = 'http://vsomesite.com/file.flv';
   $ftp_path = '/public_html/video57242/test.flv';

   // connect to FTP server (port 21)
   $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");

   // send access parameters
   ftp_login($conn_id, $usr, $pwd) or die("Cannot login");

   // turn on passive mode transfers (some servers need this)
   // ftp_pasv ($conn_id, true);

   // perform file upload
   $upload = ftp_put($conn_id, $ftp_path, $file, FTP_ASCII);

   // check upload status:
   print (!$upload) ? 'Cannot upload' : 'Upload complete';
   ?>

upload fails when the file is remote not local. what problem?


Your variables don't add up. You use $local_file in your ftp_put() call, but you only declare $file earlier in the script

And are you sure you should be using FTP_ASCII for a FLV file? I'd have thought that was binary.

Edit
Scratch my first point. Seems you edited it away :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜