Jump to content

ftp php


greengo

Recommended Posts

Does anyone know why this script doesn't work?

 

<?php

$file = $_FILES['file'];

$ftpServer = "ftp.prohosts.org";

$ftpUser = "username";

$ftpPass = "**************";

$post_dir= "files/";

if($file)

{

echo "got data";

$conn = ftp_connect($ftpServer) or die("Cannot initiate connection to host");

$login = ftp_login($conn, $ftpUser, $ftpPass) or die("Cannot login" );

echo "Sending";

$upload = ftp_put($conn, $post_dir, $file, FTP_BINARY);

}

else

{

  echo "haven't got data!!!";

}

if($upload)

{

  echo "<table width='500' border='0'><tr><td><div align='center'><h2>File uploaded OK.</h2></div></td></tr><tr><td><div align='center'><a href='http://greengo.orgfree.com/upload'><h3>GO BACK<h3></a></div></td></tr></table>";

}

else

{

  echo "<table width='500' border='0'><tr><td><div align='center'><h2>File upload failed.</h2></div></td></tr><tr><td><div align='center'><a href='http://greengo.orgfree.com/upload'><h3>GO BACK<h3></a></div></td></tr></table>";

}

ftp_quit($conn);

 

?> 

Link to comment
https://forums.phpfreaks.com/topic/51413-ftp-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.