Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

downloading files using php


  • Please log in to reply
1 reply to this topic

#1 nawin_g

nawin_g

  • Members
  • 39 posts
  • OFFLINE
  •  
  • Local time:11:46 AM

Posted 16 August 2005 - 09:02 AM

i hav been wrking with php for a while. i know how to upload files to the server using php.

well in one of my college sites there are files which are sequential in order (like a1.jpeg,a2.jpeg,a3.jpeg...)

i thought of using the copy command with source file as the www.xyz.com/a_.html and destination as my local hard disk. i kept this in a loop with the file name being incremented.

but i found that copy couldnt open the file on the server.

i really wanna know how to do this because there are over 1000 files i need to download.

can anybody know what code i should use to download stuff using php?

also can anyone tell me a nice place to learn about sessions?

BC AdBot (Login to Remove)

 


#2 ColdinCbus

ColdinCbus

  • Members
  • 312 posts
  • OFFLINE
  •  
  • Local time:12:46 PM

Posted 16 August 2005 - 04:42 PM

You probably need to do open both files and then copy.

$src = fopen('http://www.example.com/filename.txt', 'r');
$dest = fopen('http://www.yoursite.com/copy_of_file.txt', 'w');

copy($src, $dest);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users