Welcome Guest, Not a member yet? Register   Sign In
download remote file with resumable capability
#7

(This post was last modified: 06-25-2017, 04:51 AM by PaulD. Edit Reason: Added PS )

Hi programmer,

You sent me a private message but by default private messaging is switched off so I cannot reply to you. You have to turn on private messaging in your profile.

Anyway, in response, indirect download simply refers to the fact that a link you provide is not actually a link to the file, otherwise it can be shared for all to download. This is achieved relatively easily with CI.

The link you provide is something like:
PHP Code:
/downloads/download_file/this_is_the_name_of_the_file 

Your controller then checks first that the user is allowed to download the file (however you are doing your user authentication and authorisation), then you use CI download helper to read the file (which is kept outside public_html or in a file protected from direct access with file permissions and htaccess) and send download headers and the file contents so the users browser does a download and not a page view. The download helper is very easy to use and does all this for you.

The only thing you have to do is to have a table to decode the provided "this_is_the_name_of_the_file" to the actual file name kept on the server. So you might have:

PHP Code:
/downloads/download_file/online_banking_report 

But "online_banking_report" is decoded to refer to the filename "banking_report_july_2017.pdf". A direct link to the file is never shown to anyone, so there is nothing to share. And if you keep it outside public_html then only the server itself can find and read it anyway.

PHP Code:
force_download('/path/to/banking_report_july_2017.pdf'TRUE); 

What you were asking about originally, about resuming an interrupted download, is much more complex IMHO, as it depends so much on your webserver, the device the user is using and the browser.

Hope that helps,

Paul.

EDIT: PS If you knew all that already, and this is a simplistic answer for you, I apologise in advance :-)
Did not mean to patronise if this is all bloody obvious. Sorry.
Reply


Messages In This Thread
RE: download remote file with resumable capability - by PaulD - 06-25-2017, 04:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB