View Single Post
  #1  
Old 09-18-2013, 07:37 AM
hdn
Unregistered

Posts: n/a

Important phuploader, move file

hi All ,
i have a question.
i use phuploader,
can i upload file and move to another ftp server ?
i search abut this, and i fund it :

PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple FTP Upload Script using PHP by 2netlodge</title>
</head>

<body>
<?php
if(isset($_POST['ftp']))
     {
        
$ftp $_POST['ftp'];
        
$username $_POST['username'];
        
$pwd $_POST['pwd'];
        
$filename $_FILES['file']['name'];
        
$tmp $_FILES['file']['tmp_name'];
        
$d $_POST['des'];
       
        
$connect ftp_connect($ftp)or die("Unable to connect to host");
        
ftp_login($connect,$username,$pwd)or die("Authorization Failed");
        echo 
"Connected!<br/>";               
       
        if(!
$filename)
            {
                echo
"Please select a file";
            }
        else
            {
                
ftp_put($connect,$d.'/'.$filename,$tmp,FTP_ASCII)or die("Unable to upload");
                        echo
"File successfully uploaded to FTP";
            }
    }
       
               
?>
<form action="" method="post" enctype="multipart/form-data">
<input type="text" name="ftp" placeholder="FTP link"/><br/>
<input type="text" name="username" placeholder="Username"/><br/>
<input type="password" name="pwd" placeholder="Password"/><br/>
<input type="file" name="file" /><br/>
<input type="text" name="des" placeholder="Destination"  /><br/>
<br/><input type="submit" value="Upload"/></form>

</body>
</html>

how to i can move the file after upload to another server with ftp accunt?
tank you
Reply With Quote