Jump to content

Reading a file from remote server and returning the content.


naik.apoorv

Recommended Posts

Hey guys I m developing a download system for my server that reads files from a third party server and enables MY USER to download it via my URL. What mechanisms should i use to manage this efficiently ???

 

file_get_contents();
fopen();

 

Or should I use some kind of buffer mechanism ??? Please do provide a code sample as I'm stuck here very badly.

 

Note: The file sizes may be >500MB

Will it be the same file downloaded multiple times, or multiple files downloaded once? If the latter you're probably going to struggle with this as you can't 'stream' files through a browser like that. Your server would have to download the >500MB file prior to allowing the user to download it. Dependent on your server's connection speed and how many users will be downloading at once, it could be a long wait.

 

If it's the same file however, or several that are frequently used, I'd download a cached version periodically to your own server.

Will it be the same file downloaded multiple times, or multiple files downloaded once? If the latter you're probably going to struggle with this as you can't 'stream' files through a browser like that. Your server would have to download the >500MB file prior to allowing the user to download it. Dependent on your server's connection speed and how many users will be downloading at once, it could be a long wait.

 

If it's the same file however, or several that are frequently used, I'd download a cached version periodically to your own server.

 

Only a single file is to be downloaded at a time. Figuring out the problem of buffering, I had an idea of linking the download page to the file on remote server. " When the user accesses the download page it directly uses the remote file link in the header attachment ".

Whether it would work ? I have not tried though but maybe I will be up with the code today for testing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.