Jump to content

tutorial: FTP connect

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
razkid

razkid

    Newbie

  • Members
  • Pip
  • 1 posts
Welcom to my FTP connection Tutorial.
First of all i must say my english is pretty poor.
so fix me if i did a mistake.
so lets start tutorial :
fristly we need connect to port 21(ftp).
<?php

$conn = ftp_connect("ftp.codecall.com") or die("Could not connect");

ftp_login($conn,"admin","12345");

?> 
on ftp_connect function we has connected to ftp.
on ftp_login we connected with the username and pass.
now we can download file from ftp and etc.
for downloading file we need use function ftp_get.
let me give an example.
$file = "test.txt";

$open = fopen("test1.txt", "w");

ftp_fget($conn,$open,$file,FTP_ASCII);
and we downloaded to file test1.txt the info of test.txt .
last function i will teach you will be ftp_chomd.
ftp_chomd giving premission to a file.
like 0777 ,0775 and etc.
now let me show you example of the function.
ftp_chmod($conn,"0777","chomd.txt");
on the line we have been gived 0777 permssion to chomd.txt file.
Remember!
When you finish doing something with ftp functions put after it.
ftp_close($conn);


ok this is my frist tutorial on the forum.
please reply's.
:)

Edited by Orjan, 05 September 2010 - 11:27 PM.
edited the title


#2
DEViANT

DEViANT

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 358 posts
Cool. Thanks

:D You should rep+ me so that I can win :D

My Blog | Ask me!
Error : Satan did it

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
You forgot to fclose() $open
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.