4
4
4ipS2015-10-23 00:16:31
PHP
4ipS, 2015-10-23 00:16:31

Is it possible to give multiple files through readfile()?

I use the readfile() function to return the file, before that I have formed the headers.
Everything works fine, there is no memory overflow.
But there is a small problem. If the file is large, and you need to give such 3-5 files, then you have to wait for the first one to load.
Let's move on to practice:
1. you need to give 2 files, the size of which is> 100 mb
2. before the user 2 links to the download, he clicks on the first one, the download of the first file starts
3. he clicks on the second link, and here, the most interesting, the download of the second file will not start until the first file is fully loaded.
What could be the problem? if not in readfile (), then tell me in which direction to dig?
Thank you for your attention )

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2015-10-23
@Stalker_RED

Maybe somewhere there is a limit on the number of connections? Or downloading the first file completely clogs the channel?
Try to find out if the request is being sent.
In the browser F12 → Network, and see if the download starts.
You can also look at the access.log of the web server, at what point the request is being made. Or check with wireshark.

S
smilingcheater, 2015-10-23
@smilingcheater

It's possible that the problem is with sessions - PHP, when storing the session in files, hangs concurrent requests other than the first one, until the first releases the session.

A
alegzz, 2015-10-25
@alegzz

if you open a separate window for each link? HTTP does not know how to download 2 files at the same time in a session

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question