Hide Download file URL
Moderator: General Moderators
Hide Download file URL
i am beginner in php and try to make a website in php..
i want to hide the url of the download file, can any one help me do this??
please help me...
thanks
i want to hide the url of the download file, can any one help me do this??
please help me...
thanks
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Hide Download file URL
http://www.kavoir.com/2009/05/php-hide- ... cript.html
Looks like a good place to start
Looks like a good place to start
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Hide Download file URL
i have tryed that one, but its not working...
Re: Hide Download file URL
That is pretty much it. so what isn't working? It gives you errors? It is showing file instead of downloading? What browsers are you trying it in?
-Greg
-Greg
Re: Hide Download file URL
i am running this on my localhost using wamp server
and i am using firefox as a browser
its downloading the file but its only able to download 1.3kb from the file..
and i am using firefox as a browser
Code: Select all
<?php
$path = 'C:/wamp/www/test.avi'; // the file made available for download via this PHP file
$mm_type="application/octet-stream"; // modify accordingly to the file type of $path, but in most cases no need to do so
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($path)) );
header('Content-Disposition: attachment; filename="'.basename($path).'"');
header("Content-Transfer-Encoding: binary\n");
readfile($path); // outputs the content of the file
exit();
?>Re: Hide Download file URL
Open the file in something like notepad++, see if it looks like a source code from a webpage that is displaying an error. If not, and the begining of that file looks the same as the actual file you are trying to get, check what value is being given for Content-Length.
-Greg
-Greg
Re: Hide Download file URL
????twinedev wrote:Open the file in something like notepad++, see if it looks like a source code from a webpage that is displaying an error. If not, and the begining of that file looks the same as the actual file you are trying to get, check what value is being given for Content-Length.
-Greg
i dont understand you???
i have checked the content-length and it is same as real file size..
Re: Hide Download file URL
Does the 1.3kb of data you get from the download match the first 1.3kb of the file you are trying to download? if not, what is it?
Do not assume what you received from the server was the type of file you think you should be getting. Perhaps there is an error generating from the server, and what you are actually downloading is the error message the server is outputting, just named as what you thought you wanted to get.
-Greg
Do not assume what you received from the server was the type of file you think you should be getting. Perhaps there is an error generating from the server, and what you are actually downloading is the error message the server is outputting, just named as what you thought you wanted to get.
-Greg
Re: Hide Download file URL
i am trying to download an avi file(movie)..
when i run the php script it starts downloading the test.avi file,but without any error the download get completed with only 1.3kb file..
thank you
when i run the php script it starts downloading the test.avi file,but without any error the download get completed with only 1.3kb file..
thank you
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Hide Download file URL
Tried the code in FF and IE9; works fine. Try modifying your path where the file resides.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Hide Download file URL
If you get an error, since you are "downloading" the output of the script, you will not see it on the screen, it will be in the file, thus, why I said to open the 1.3kb file in a text editor to see what it looks like.Xeolex wrote:i am trying to download an avi file(movie)..
when i run the php script it starts downloading the test.avi file,but without any error the download get completed with only 1.3kb file..
thank you
-Greg
Re: Hide Download file URL
here is the file contant
thank you..
Code: Select all
<br />
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 945367041 bytes) in C:\wamp\www\test.php on line <i>15</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0008</td><td bgcolor='#eeeeec' align='right'>380496</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\wamp\www\test.php' bgcolor='#eeeeec'>..\test.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0013</td><td bgcolor='#eeeeec' align='right'>381464</td><td bgcolor='#eeeeec'><a href='http://www.php.net/readfile' target='_new'>readfile</a>
( )</td><td title='C:\wamp\www\test.php' bgcolor='#eeeeec'>..\test.php<b>:</b>15</td></tr>
</table></font>
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Hide Download file URL
There's something you can search for. Looks like the file downloaded is the error page.Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 945367041 bytes) in C:\wamp\www\test.php on line
http://www.tech-recipes.com/rx/777/solv ... ted-tried/
Have a look at this url
Hth
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Hide Download file URL
its seem in my php.ini it sets to 128M
anyone knows whats the problem??
and what can i do to overcome this error??
thanks..
Code: Select all
memory_limit = 128Mand what can i do to overcome this error??
thanks..
Re: Hide Download file URL
And how big is the file you are trying to download?
-Greg
-Greg