Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 2nd, 2007, 01:13 AM
Authorized User
 
Join Date: Dec 2006
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with downloading with php..pls help urgent

Hi
I am developing a page on which I am downloading the files using php.and on the same page i have another submit button. After downloading any file when i write something and press submit button the donwloading dialog opens automatically. I have used all codes for cache but nort working.
pls help me
here is the code to download a file
$file='a.doc';/// for example
$ext='doc';/// for example
header("Content-type: application/$ext");
header("Content-Disposition: attachment; filename=$file");
readfile($file);
exit;

after downloading as soon as i press the submit button this code generates again.


pls help urgent
thanks

 
Old November 9th, 2007, 02:48 AM
Registered User
 
Join Date: Nov 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to asanga
Default

it works but this code should be in the top of the page
<?php
$file='a.doc';/// for example
$ext='doc';/// for example
header("Content-type: application/$ext");
header("Content-Disposition: attachment; filename=$file");
readfile($file);
exit;
?>
there shouldn't be any blank line before the code

Asanga Amarawansa
asanga@needmatch.biz
http://www.needmatch.biz





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can any one help me pls Urgent..? venkatu2005 ASP.NET 1.0 and 1.1 Basics 1 April 8th, 2008 08:45 AM
PHP with IFRAME..pls help me its URGENT raaj Beginning PHP 2 February 26th, 2007 03:12 AM
Downloading files using JSP...Urgent!! Bhimashankarkulkarni Javascript 2 March 1st, 2005 05:42 AM
datagrid problem urgent pls. dsmportal Pro VB.NET 2002/2003 0 February 7th, 2005 09:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.