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 function using PHP's FTP abilities.
Categories : PHP, Filesystem, FTP Click here to Update Your Picture
Doug Pillow
Date : Feb 20th 2003
Grade : 3 of 5 (graded 18 times)
Viewed : 82016
File : image_upload.php
Images : No Images for this code example.
Search : More code by Doug Pillow
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

prepare a form similiar to this and have it call the below file
<?php
echo '<form action="image_upload.php" method="post" enctype="multipart/form-data">';
echo
'Click the Browse button to find the file you wish to upload';
echo
'<input type="file" name="imagefile">';
echo
'<INPUT TYPE="submit" name="upload" value="upload">';
echo
'</form>';

/**************************************************************************************
***************************************************************************************       
***    <input type="file" name="imagefile">                             
***    with the above tag declared in the calling form                               
***    the variable name is $imagefile and the available properties are           
***    $imagefile :name of the file as stored on the temporary server directory   
***    $imagefile_name :filename.extension of the file as on the users machine     
***    $imagefile_size    :size in bytes of the file                                 
***    $imagefile_type    :the type of file image/gif image/jpg  text/html etc....   
***                                                                                 
***************************************************************************************
**************************************************************************************/

//change these values to suit your site
$ftp_user_name='XXXXXXXX';
$ftp_user_pass='XXXXXXXX';
$ftp_server='ftp.YOURSITE.com';
$ftp_dir='/YOURSITE.COM/public_html/upload/';

//$web_location is needed for the file_exists function, the directories used by FTP
//are not visible to it will always return not found.

$web_dir='../upload/';
$web_location=$web_dir.$imagefile_name;

//build a fully qualified (FTP) path name where the file will reside
$destination_file=$ftp_dir.$imagefile_name;

// connect, login, and transfer the file
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$upload = ftp_put($conn_id, $destination_file, $imagefile, FTP_BINARY);

//use ftp_site to change mode of the file
//this will allow it be visible by the world,
$ch=ftp_site($conn_id,"chmod 777 ".$destination_file);

// close the FTP stream
ftp_close($conn_id);

//verify file was written
if (file_exists($web_location))
    {
    echo
"file was uploaded as $web_location";
    }
else
    {
    echo
"Could not create $web_location";
    }
//end if
?>



Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support
Categories : PHP, FTP, Filesystem, PHP Classes, Compression
Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP
Moving folder hierarchy b/w server
Categories : PHP, FTP, Filesystem
Fetching product details from the commission junction website using php
Categories : PHP, FTP, Filesystem, Compression
A PHP Script that shows how to use FTP to run a shell script, read two local files and update data in a database.
Categories : PHP, Filesystem, FTP, Date Time, Databases
Using PHP to Delete a directory with all sub directories and files using FTP
Categories : PHP, FTP, Directories, Filesystem
Open directory and File download
Categories : PHP, Filesystem, Directories, HTML and PHP
3 lines of Code to extract Tar, Zip, Gzip etc..
Categories : PHP, Filesystem, PHP Classes, Compression
GuestBook Light - a plug and play application for any website.
Categories : PHP, Complete Programs, Filesystem, Sessions
Bs_IniHandler is a class that can read and write ini-style files (and strings)
Categories : PHP, Filesystem, PHP Classes
Relative Path
Categories : PHP, Filesystem
Check if a file exists on a remote FTP server with PHP
Categories : PHP, FTP, Regexps
A File Browser Class.To Read Drives,Directories and Files .Files writing is also possible
Categories : PHP, PHP Classes, Filesystem
Link Submition - Allow your visitors to submit links to the site.
Categories : PHP, Arrays, Filesystem, Beginner Guides
Upload Via FTP - an alternative to move_uploaded_file
Categories : PHP, FTP, Beginner Guides