| | |
can someon explain it to me please
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 17
Reputation:
Solved Threads: 0
In the follwing code i want want to know how i can put my information in the
file
filename
distinamtion_file
i want to use this code to upload a file from my computer to ftp server
file that i want to upload is in my 'C/SITE/file.txt@ folder
and i want to uplload it to
/WEEBROOT/WILBLOURN/FTPTEST
can some wriye to me the syntax for this.
code is belove
file
filename
distinamtion_file
i want to use this code to upload a file from my computer to ftp server
file that i want to upload is in my 'C/SITE/file.txt@ folder
and i want to uplload it to
/WEEBROOT/WILBLOURN/FTPTEST
can some wriye to me the syntax for this.
code is belove
PHP Syntax (Toggle Plain Text)
<? $name = "FILE NAME"; $filename = "FILE NAME WITH FULL PATH"; //-- Code to Transfer File on Server Dt: 06-03-2008 by Aditya Bhatt --// //-- Connection Settings $ftp_server = "IP ADDRESS"; // Address of FTP server. $ftp_user_name = " SERVER USERNAME"; // Username $ftp_user_pass = " SERVER PASSWORD"; // Password $destination_file = " SERVER FILE PATH TO UPLOAD VIA FTP_PUT"; //where you want to throw the file on the webserver (relative to your login dir) $conn_id = ftp_connect($ftp_server) or die("<span style='color:#FF0000'><h2>Couldn't connect to $ftp_server</h2></span>"); // set up basic connection $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass) or die("<span style='color:#FF0000'><h2>You do not have access to this ftp server!</h2></span>"); // login with username and password, or give invalid user message if ((!$conn_id) || (!$login_result)) { // check connection // wont ever hit this, b/c of the die call on ftp_login echo "<span style='color:#FF0000'><h2>FTP connection has failed! <br />"; echo "Attempted to connect to $ftp_server for user $ftp_user_name</h2></span>"; exit; } else { //echo "Connected to $ftp_server, for user $ftp_user_name <br />"; } $upload = ftp_put($conn_id, $destination_file.$name, $filename, FTP_BINARY); // upload the file if (!$upload) { // check upload status echo "<span style='color:#FF0000'><h2>FTP upload of $filename has failed!</h2></span> <br />"; } else { echo "<span style='color:#339900'><h2>Uploading $name Completed Successfully!</h2></span><br /><br />"; } ftp_close($conn_id); // close the FTP stream ?>
![]() |
Other Threads in the PHP Forum
- Previous Thread: uploading to ftp server my directory hae some problom
- Next Thread: fwrite not working with ob_start, Any ideas?
| Thread Tools | Search this Thread |
apache api array basic binary body broken cakephp class cms code computing confirm cron curl customizableitems database date date/time delete dynamic ebooks email error file filter folder form forms forum function functions gc_maxlifetime header headmethod href htaccess html iframe image include ip javascript joomla limit link list login malfunction mediawiki memmory memory menu msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter parsing paypal pdf php phpincludeissue query question random recourse regex script search seo server sessions snippet source sp space speed sql static subdomain system table tag thesishelp trouble tutorial update upload url variable vbulletin web webdesign white xml youtube





