Is it possible in php to determine the downloaded file or not?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
5 views
You need to understand is it possible using php to determine the file you downloaded, and if Yes, how many times.


I something like this possible I do not remember and do not see.

You can do with AJAX + PHP

but it's not.
by | 5 views

7 Answers

0 like 0 dislike
The only sposob to make sure that the client has received the entire file to check if it has received all the data and check whether there is the error. For hardcore case we think that the client downloads the file chunks in many threads and each piece is considered a separate completed return. The only way to be sure that the file given is to sum the sizes and compare Rungis. So either you write a detailed log to include these things, or use a Directive with variables sootvetsvujushchimi
\r
To verify the absence of errors can only parsya log. For udobstva parsing it is necessary to customize the format and level of the log and parse it by comparing zalogowania requests. Unfortunately, this still does not guarantee that the client file was received for the absence of HTTP errors does not guarantee correct saving on the screw.
\r
If you want hardcore to be sure that the file is dropped on the screw of the client in safe and sound — make Downloader all combined in flash, Java, or other silverlite clientside technology which will be able to check the result of the race. It is you exactly want
by
0 like 0 dislike
if you really want, you can give a file a script. type
\r/getfile.php?id=12345
and on the server $filename = get_filename_by_id($_GET['id']);
readfile($filename);
// increment counter
// profit!
\r

you will believe that you have sent (but not the fact that the customer accepted it)
and this will somewhat increase the load.
\r
another option is to give the user a link to a script that will increment the counter, and then redirected on the file.
but again, you will not be sure that the client has received the file.
\r
in the case of images, they can be displayed in the browser, and on the onload of pictures to send a message to the server. if desired, the client can check the integrity of the picture.
by
0 like 0 dislike
Than files given? I heard that nginx has some kind of action after the return of the file, who knows, write please.
by
0 like 0 dislike
Clearly there is no guarantee. Even if the server gave the entire file, that the file was completely downloaded by the client — not the fact.
by
0 like 0 dislike
Of course, it is impossible and PHP here at anything.
by
0 like 0 dislike
Hmm... maybe I should play with partial-content? I.e. suppose we have a server script that gives the file. In addition, he counts start downloading it artificially gives not the entire file, but only part (the last 10 bytes for example). Ie, when the browser requests the last 10 bytes in a separate request — this is the fact that the end of injection. I really don't know how to react to the browser in the response headers Content-Range and Content-Length no initiated from their side of the Range header, but to try I think. Write, if possible, very interesting ))
by
0 like 0 dislike
And then you don't have too many options. I would have made the php + Nginx + x-accel-redirect + nginx log analysis.
by
110,608 questions
257,186 answers
0 comments
26,152 users