[Please] access any file url and return any file name to the user for download ?????? Access any file url and return any file name to the user for download ??????
Case:
Http://down1.020pidai.com/8935/the server has only one file ..
For example, 000000.exe
The following functions are required:
Users can download files of any name by accessing any name, without the occurrence of 404 misaligned files
Access
Http://down1.020pidai.com/8935/111111.exe
The server returns 111111.exeto download the file to the user. the user can download the file named 1111.exe, but not the file named 00.exe on the server.
Http://down1.020pidai.com/8935/222222.exe
Bytes
Troublesome
Reply to discussion (solution)
When is the user's input name, only the file 00.exe is downloaded?
Header ("Content-Disposition: attachment; filename=000000.exe ");
When is the user's input name, only the file 00.exe is downloaded?
Header ("Content-Disposition: attachment; filename=000000.exe ");
Your code is used to download 00.exe, but the received file name is 00.exe.
When is the user's input name, only the file 00.exe is downloaded?
Header ("Content-Disposition: attachment; filename=000000.exe ");
The result I want is that the server only has a file named cmd00.exe.
When you access www.url.com/down/111111.exe, 111111.exeis saved, but not 00.exe.
When you access www.url.com/down/222222.exe, 222222.exeis saved, but not 00.exe.
Hiding the object name using urlrewrite
So/8935/222222 .exe in the http://down1.020pidai.com/8935/222222.exe is passed into the entry file as PATH_INFO
In/8935/222222. .exe
8935 represents the actual cmd00.exe
222222. exe is the header ("Content-Disposition: attachment; filename = $ filename"); $ filename
Can it be understood?
Hiding the object name using urlrewrite
So/8935/222222 .exe in the http://down1.020pidai.com/8935/222222.exe is passed into the entry file as PATH_INFO
In/8935/222222. .exe
8935 represents the actual cmd00.exe
222222. exe is the header ("Content-Disposition: attachment; filename = $ filename"); $ filename
Can it be understood?
Write the code like this ??? It seems that the code has not been mentioned and the download has not completed.
Header ("Content-Disposition: attachment; filename = $ filename"); $ filename
?>
How can I access this? Save the preceding code as exe. php in the root directory www.url.com/exe.php.
Www.url.com/down /***
Pseudo static rewrite www.url.com/exe.php ???
Is that true ??
Understand !!
All code
Create exe. php
Code:
Header ("Content-Disposition: attachment; filename = $ filename"); $ filename
?>
Create a. htaccess file
Code:
RewriteEngine On
RewriteBase/
RewriteRule ^ index \. php $? [L]
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
RewriteRule./index. php [L]
Create directory 8935
Create a. htaccess file in directory 8935
The code is as follows:
RewriteEngine On
RewriteBase/8935/
RewriteRule ^000000 \. exe $? [L]
RewriteRule./cmd00.exe [L]
Put "000000.exe" in the directory 8935.
In this way, access www.url.com/8935/with the name .exe
The obtained file is:
Enter the name .exe
Apache can use httpd. ini of iis. how can this problem be solved?
Hiding the object name using urlrewrite
So/8935/222222 .exe in the http://down1.020pidai.com/8935/222222.exe is passed into the entry file as PATH_INFO
In/8935/222222. .exe
8935 represents the actual cmd00.exe
222222. exe is the header ("Content-Disposition: attachment; filename = $ filename"); $ filename
Can it be understood?
Can iis of the moderator achieve this effect? in httpd. ini