登录 | 注册 | FAQ
Anonymous

Php Uploader

+ 发表回复

3 篇帖子 分页: 1 / 1


Php Uploader

Chikwado » 周日 3月 15, 2015 6:09 am

最后由 Chikwado 编辑于 周一 3月 23, 2015 11:39 am,总共编辑了 2 次

头像

Chikwado

  • 帖子: 87
  • 注册: 周一 7月 29, 2013 11:36 pm
  • 地址: Nigeria

Re: Php Uploader

brata123456789 » 周日 3月 22, 2015 10:25 am

<?php
$ftp_server = "XXXXXXXXX"; // Address of FTP Server
$ftp_user_name = "XXXXXXXXXX"; // Username
$ftp_user_pass = "XXXXXXXXXXXX"; // Password
// Locations and others
$remote_dir = "/www_root/uploaded_files";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

$file_url = "";
if($login_result) {
//set passive mode enabled
ftp_pasv($conn_id, true);


if ($file == "")
{
echo
"<script type=\"text/javascript\">".
"window.alert('You havent chosed file');".
"top.location = 'index.html';".
"</script>";


exit;
}
$file = $_FILES["file"]["tmp_name"];
$remote_file = $_FILES["file"]["name"];

$ret = ftp_nb_put($conn_id, $remote_file, $file, FTP_BINARY, FTP_AUTORESUME);
while(FTP_MOREDATA == $ret) {
$ret = ftp_nb_continue($conn_id);
}
if($ret == FTP_FINISHED) {
echo
"<script type=\"text/javascript\">".
"window.alert('File uploaded');".
"top.location = 'index.html';".
"</script>";

} else {
echo
"<script type=\"text/javascript\">".
"window.alert('Upload was not succesful');".
"top.location = 'index.html';".
"</script>";
}
}
?>


My php script.. Just copy paste it , ..
$ftp_server = "XXXXXXXXX"; / - here u must enter your ftp server name ( instead of XXXXX)
$ftp_user_name = "XXXXXXXXXX"; // here u must enter your ftp server username
$ftp_user_pass = "XXXXXXXXXXXX"; -----------.. u know what to do
头像

brata123456789

  • 帖子: 2
  • 注册: 周五 3月 20, 2015 9:29 pm

Re: Php Uploader

Chikwado » 周四 3月 26, 2015 7:40 pm

头像

Chikwado

  • 帖子: 87
  • 注册: 周一 7月 29, 2013 11:36 pm
  • 地址: Nigeria


+ 发表回复

分页: 1 / 1