WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Upload Via FTP - an alternative to move_uploaded_file
Categories : PHP, FTP, Beginner Guides
Moiz Sitabkhan
Date : May 24th 2007
Grade : 4 of 5 (graded 2 times)
Viewed : 7922
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Moiz Sitabkhan
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

This is a useful function if you want to transfer files between SERVERS. NOTE : sometimes you wish to transfer files between two servers... or if you have built a CMS and you want ot install the program on a clients server, it is advisable to transfer files by FTP rather than the move_uplaoded_file. This function accepts a parameet -- location of the file

<?php
function uploadFileFTP($FileName) {
   
//connect to the ftp server
   
$conn_id = ftp_connect(FTP_SERVER_ADDRESS);
   
   
// login with username and password
   
$login_result = ftp_login($conn_id, FTP_USER, FTP_PASSWORD);

   
// check connection
   
if ((!$conn_id) || (!$login_result)) {
        echo
error="FTP connection has failed!<br>Attempted to connect to ".FTP_SERVER." for user : ".FTP_USER;
        return
false;
    }

   
//skip these two steps if you dont want to change the working directory
   
ftp_chdir($conn_id, "wwwroot");
   
ftp_chdir($conn_id, "my_folder");
       
   
// upload the file
   
$upload = ftp_put($conn_id, $FileName, $source_file, FTP_BINARY);

    if (!
$upload) {
        echo
error="FTP upload has failed!";
       
ftp_close($conn_id);
        return
false;
    } else {
       
ftp_close($conn_id);
        return
$FileName;
    }
}
?>



Selecting a random line from a text file
Categories : PHP, Filesystem, Arrays, Beginner Guides
Newbie Notes #3 - What went wrong? A useful little debugging aid
Categories : PHP, Beginner Guides, Debugging
How to Insert a Date Format Into MySQL from PHP
Categories : PHP, Databases, MySQL, Date Time, Beginner Guides
Form Submission Using Array's
Categories : PHP, HTML and PHP, Beginner Guides, Arrays
Local Time clock and Server time usign PHP and JavaScript
Categories : PHP, Java Script, Date Time, Beginner Guides
Simple SOAP Example (with SoapClient)
Categories : PHP, Web Services, SOAP, Beginner Guides
PHP Class to calculate Degrees Minutes Seconds to Decimal Degrees
Categories : PHP, PHP Classes, Geo Related, Beginner Guides
Script loading time
Categories : PHP, Beginner Guides, Date Time
PHP Email image generator - hide your email from bots - using the GD Library
Categories : PHP, Graphics, GD image library, Beginner Guides
Different Call User Functions
Categories : PHP, Functions, Beginner Guides
WebFTP: This tool can be used to access FTP sites from behind any firewall or proxy.
Categories : PHP, FTP
Reverse a given number
Categories : PHP, Beginner Guides, Algorithms, Math.
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
Check for functional file links (broken Files)
Categories : PHP, Data Validation, FTP, Regexps, Arrays