mercredi 11 mars 2015

Uploading a file from local to server through FTP using PHP


Vote count:

0




I would like to upload a file to server from my local. I have tried following code but it is giving some error. Please help me to resolve



<?php
$server="115.120.147.261";
$ftp_user_name="root";
$ftp_user_pass="3424dd";
$dest="/home/root/web/Price-War/";
$source="/home/root/sample.txt";
$connection = ftp_connect($server);
if($connection)
{
echo "Connection Established";
}
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);

if (!$connection || !$login) { die('Connection attempt failed!'); }

$upload = ftp_put($connection, $dest, $source, FTP_ASCII);

if (!$upload) { echo 'FTP upload failed!'; }

ftp_close($connection);
?>


Its throwing following error.



Connection Established
PHP Warning: ftp_put(): Could not create file. in /home/root/Desktop/upload.php on line 16


asked 1 min ago







Uploading a file from local to server through FTP using PHP

Aucun commentaire:

Enregistrer un commentaire