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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.