GetDotted Domains

Viewing Thread:
"PHP ftp_put command..."

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Thu 12/08/04 at 11:24
Regular
"Pouch Ape"
Posts: 14,499

$new_file_name = "filename.jpg";

$file_a = "$form_image_a";
$remote_file = "$new_file_name";
$ftp_host = "hostname";
$conn_id = ftp_connect($ftp_host);

$ftp_user_name = "username";
$ftp_user_pass = "password";

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

if(ftp_put($conn_id, $remote_file, $file_a, FTP_BINARY))
{ print("Successfully uploaded $file_a \n"); }
else
{ print("There was a problem while uploading $file_a \n"); }

ftp_close($conn_id);

?>


What's wrong with that? Please.
Thu 12/08/04 at 11:24
Regular
"Pouch Ape"
Posts: 14,499

$new_file_name = "filename.jpg";

$file_a = "$form_image_a";
$remote_file = "$new_file_name";
$ftp_host = "hostname";
$conn_id = ftp_connect($ftp_host);

$ftp_user_name = "username";
$ftp_user_pass = "password";

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

if(ftp_put($conn_id, $remote_file, $file_a, FTP_BINARY))
{ print("Successfully uploaded $file_a \n"); }
else
{ print("There was a problem while uploading $file_a \n"); }

ftp_close($conn_id);

?>


What's wrong with that? Please.
Thu 12/08/04 at 16:43
Regular
Posts: 5,323
My knowledge of PHP is very limited.
But shouldn't there be a ';' after:
if(ftp_put($conn_id, $remote_file, $file_a, FTP_BINARY))';'< There?

Probably not but my knowledge of PHP is poor.

Edit:
Oh..
Also wouldnt you have to specify the size of the file that you wish to upload?
Thu 12/08/04 at 16:52
Regular
Posts: 4,279
If it's anything like C++ then you dont use semi colons on if statements.
Thu 12/08/04 at 16:57
Regular
Posts: 5,323
How about turning on Passive Mode?
Because the script is trying to act like a client.
Thu 12/08/04 at 20:42
Regular
"Eff, you see, kay?"
Posts: 14,156
What's the error you were getting?
Thu 12/08/04 at 21:00
Regular
"Pouch Ape"
Posts: 14,499
I actually get the correct - "There was a problem while uploading $file_a \n" - error message, so the code is working to an extent. I'm pretty sure it's enabled, because it's an open server, so why would they disallow it?
Thu 12/08/04 at 21:00
Regular
"It goes so quickly"
Posts: 4,083
Mode wrote:
> My knowledge of PHP is very limited.
> But shouldn't there be a ';' after:
> if(ftp_put($conn_id, $remote_file, $file_a, FTP_BINARY))';'<
> There?

Not in this case, as an if statement is being used. If you look on the next line, you'll see he's opening up the block with the {.
Thu 12/08/04 at 21:04
Regular
"It goes so quickly"
Posts: 4,083
Do you have the correct permissions set on the folder which accepts the files?
Thu 12/08/04 at 21:29
Regular
"Pouch Ape"
Posts: 14,499
Yip, no problems there.
Thu 12/08/04 at 23:19
Regular
"Eff, you see, kay?"
Posts: 14,156
Tried specifying absolute paths or trying to acquire a more verbose error message?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Unrivalled services
Freeola has to be one of, if not the best, ISP around as the services they offer seem unrivalled.
My website looks tremendous!
Fantastic site, easy to follow, simple guides... impressed with whole package. My website looks tremendous. You don't need to be a rocket scientist to set this up, Freeola helps you step-by-step.
Susan

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.