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 : This is a simple PHP function to copy a remote file into a local drive. So it's a kind of downloader script. Please check if your server allow remote url_fopen, otherwise it won't work.
Categories : PHP, Filesystem
Yeni Setiawan
Date : Jul 27th 2007
Grade : 3 of 5 (graded 7 times)
Viewed : 34548
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Yeni Setiawan
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.
 

<?php
function copyFile($url,$dirname){
    @
$file = fopen ($url, "rb");
    if (!
$file) {
        echo
"<font color=red>Failed to copy $url!</font><br>";
        return
false;
    }else {
       
$filename = basename($url);
       
$fc = fopen($dirname."$filename", "wb");
        while (!
feof ($file)) {
           
$line = fread ($file, 1028);
           
fwrite($fc,$line);
        }
       
fclose($fc);
        echo
"<font color=blue>File $url saved to PC!</font><br>";
        return
true;
    }
}
?>



Usage Example:
<?php
copyFile
("http://test-server.com/file/movie.mpg","myfolder/");
?>




Differences between two files
Categories : PHP, Filesystem, Tip
Directory Viewer, Directory Content Viewer, Directory Structure to HTML. This code will basically create a complete set of HTMLs to let a user navigate through any directory you want. Excellent code for large file sharing pages.
Categories : Directories, Filesystem, PHP
PHP Transfer data from text file to Mysql Table
Categories : PHP, PHP Classes, Filesystem, Databases, MySQL
Using php3 to upload files, uploading files, file uploads.
Categories : PHP, Filesystem, HTTP
Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
PHP based Contact email form with multiple recipients, text file based, supports departments.
Categories : PHP, Email, Beginner Guides, Filesystem
Checking to see if a file exists with PHP
Categories : PHP, Filesystem, Perl
File Explorer, browse, upload, download and edit your web site files with only a browser and a HTTP connection.
Categories : Complete Programs, Content Management, Filesystem, PHP
How to let a user download a picture by clicking on it instead of needing to right click and Save-As.
Categories : HTTP, PHP, HTML and PHP, Filesystem
Filling an array with files from any given directory. This example is for the current PHP script's directory.
Categories : PHP, Arrays, Filesystem
Contents Page - a script to build contents pages.
Categories : Complete Programs, PHP, Utilities, Filesystem
How to ifconfig down/up a list of IP's
Categories : Arrays, Strings, Filesystem, PHP
Variable serialization and unserialization. Loading and saving variable structures to and from file.
Categories : Arrays, Filesystem, Variables, Strings, PHP
Simple pipe delimited file export program that downloads to a local machine
Categories : PHP, Filesystem, Databases, MySQL, HTTP
Fetching product details from the commission junction website using php
Categories : PHP, FTP, Filesystem, Compression
 Gerard van Beek wrote :1695
Wouldn`t it be simpler to use the copy command?