Warning: include(.../cache/template/template63867.php): failed to open stream: No such file or directory in /home/codingta/public_html/includes/vb5/template.php on line 328 Warning: include(): Failed opening '.../cache/template/template63867.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/codingta/public_html/includes/vb5/template.php on line 328 [Script] How to Upload files to FTP Using PHP - Coding-Talk

[Script] How to Upload files to FTP Using PHP

  • Filter
  • Time
  • Show
Clear All
new posts

  • [Script] How to Upload files to FTP Using PHP

    Hi all,

    It seems amazing seeing PHP managing FTP, below is a script i coded for uploading files to FTP and its fantastic! :D
    <!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">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Simple FTP Upload Script using PHP by 2netlodge</title>
    		$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/>";				
    				echo"Please select a file";
    				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>
    <footer>Share and get more scripts and codes like this, visit <a href="http://2netlodge.com">http://2netlodge.com</a> Forum</footer>
    Hope it helps!