Understanding downloaded file location in php

I have this code in download.php file:

$file = //path to file (for example .xlsx file)
if (file_exists($file)) {
        header('Content-Description: File Transfer');
        header('Content-Type: application/vnd.ms-excel');
        header('Content-Disposition: attachment; filename=file.xlsx');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        readfile($file);
        exit;
    }

So, if open site.com/download.php, excel file is downloaded.

My question is:

somehow, downloader can understand what is a downloaded xlsx file location on the server? or this is impossible?

Answers


No. The client will have no idea where on the server the excel file came from.

You could be generating it in realtime or scraping it from another site or loading from a file. No way to tell.


Need Your Help

Why does my code break when using a hash symbol, instead of a hash string?

ruby string hash symbol

I have a scenario that when I try to access a hash key using a symbol it doesn't work, but when I access it with a string it works fine. It is my understanding that symbols are recommended over st...

Again, Class not found

haxe openfl haxelib stablexui

When I have upgraded stablexui to the last version, I first removed it:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.