rain13 Posted December 5, 2015 Share Posted December 5, 2015 (edited) Hello. I made simple php script to download attachments but I have problem that instead of my_file.txt I get upload.php for file name: <?php 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: application"); header('Content-Disposition: attachment; filename="my_file.txt"'); header("Content-Transfer-Encoding: binary"); header("Content-Length: 5"); echo "Hello"; ?> Any suggestions? Edited December 6, 2015 by SoItBegins Link to comment Share on other sites More sharing options...
Don E Posted December 5, 2015 Share Posted December 5, 2015 Go to this link: http://php.net/manual/en/function.readfile.php There you'll see an example of what you're trying to accomplish. Check to see if you're missing anything from your code compared to the example. Link to comment Share on other sites More sharing options...
rain13 Posted December 6, 2015 Author Share Posted December 6, 2015 Tnx, got it work. Edited the post above so that who ever finds it can now copy-paste this code. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now