kleb Posted December 26, 2011 Share Posted December 26, 2011 please can anyone tell me what php ftp is used for?? thanks Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/ Share on other sites More sharing options...
melloorr Posted December 26, 2011 Share Posted December 26, 2011 It means File Transfer Protocol and it is used instead of http (i.e. ftp://www.example.com/). It is mainly used in uploading files to sites, (like through FileZilla) but it can also be used to download from sites. I do not know HOW to use it though, but someone else should be able to tell you Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301398 Share on other sites More sharing options...
ZulfadlyAshBurn Posted December 26, 2011 Share Posted December 26, 2011 For you to upload and download files from your server. See more Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301399 Share on other sites More sharing options...
kleb Posted December 26, 2011 Author Share Posted December 26, 2011 please can you teach me how to use it for both upload and download thanks Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301400 Share on other sites More sharing options...
ZulfadlyAshBurn Posted December 26, 2011 Share Posted December 26, 2011 Why would you need it in the first place? Do you know how it works and what it is for? Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301401 Share on other sites More sharing options...
The Little Guy Posted December 26, 2011 Share Posted December 26, 2011 you can use ftp to bypass php max file upload limit I believe (Not the only use though). You don't need to use it for download though. php.net file upload: <?php $file = 'somefile.txt'; $remote_file = 'readme.txt'; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a file if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?> php.net file download: <?php // define some variables $local_file = 'local.zip'; $server_file = 'server.zip'; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo "Successfully written to $local_file\n"; } else { echo "There was a problem\n"; } // close the connection ftp_close($conn_id); ?> Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301403 Share on other sites More sharing options...
melloorr Posted December 26, 2011 Share Posted December 26, 2011 please can you teach me how to use it for both upload and download thanks As I said in your previous thread, MediaFire is sufficient for your needs. Having people download from your website will only increase your bandwidth usage, thus costing you more money. Money which wouldn't have needed to be spent in the first place. Plus, if too many people download at one time, your server will slow to a crawl. Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301405 Share on other sites More sharing options...
objnoob Posted December 26, 2011 Share Posted December 26, 2011 All you need to do is upload the file to your website's "webspace." Then you access the file via the URL. You do not need PHP to accomplish allowing users to simply download from your site. www.yourwebsite.com/downloads/MP3file.mp3 Quote Link to comment https://forums.phpfreaks.com/topic/253848-php-ftp/#findComment-1301416 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.