Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7332 > unrolled thread
| Started by | Nagender <nagender.goldenslash@gmail.com> |
|---|---|
| First post | 2012-10-16 07:21 -0700 |
| Last post | 2012-10-17 03:46 -0700 |
| Articles | 5 — 4 participants |
Back to article view | Back to comp.lang.php
download a file after user enters some data in php Nagender <nagender.goldenslash@gmail.com> - 2012-10-16 07:21 -0700
Re: download a file after user enters some data in php The Natural Philosopher <tnp@invalid.invalid> - 2012-10-16 15:27 +0100
Re: download a file after user enters some data in php Jerry Stuckle <jstucklex@attglobal.net> - 2012-10-16 12:15 -0400
Re: download a file after user enters some data in php Michael Vilain <vilain@NOspamcop.net> - 2012-10-16 09:46 -0700
Re: download a file after user enters some data in php Nagender <nagender.goldenslash@gmail.com> - 2012-10-17 03:46 -0700
| From | Nagender <nagender.goldenslash@gmail.com> |
|---|---|
| Date | 2012-10-16 07:21 -0700 |
| Subject | download a file after user enters some data in php |
| Message-ID | <79a88c4d-32a2-4545-86d3-02ec367f365f@googlegroups.com> |
Hi to all, In my working website user has to download a pdf file once he submits some information. No hyperlinks has to show directly file has to download. I have the idea using hyperlink, that means once user enter details ,it will redirects to another page. this is not case. It has to download there it self. Please any one has idea, let help me. I am searching for this since last 4-5 hr's.
[toc] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2012-10-16 15:27 +0100 |
| Message-ID | <k5jqt9$rib$1@news.albasani.net> |
| In reply to | #7332 |
Nagender wrote: > Hi to all, > In my working website user has to download a pdf file once he submits some information. > No hyperlinks has to show directly file has to download. > > I have the idea using hyperlink, that means once user enter details ,it will redirects to another page. > this is not case. > It has to download there it self. > Do you mean you want to go to another page after downloading? > Please any one has idea, let help me. > I am searching for this since last 4-5 hr's. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-10-16 12:15 -0400 |
| Message-ID | <k5k16t$j0m$1@dont-email.me> |
| In reply to | #7332 |
On 10/16/2012 10:21 AM, Nagender wrote:
> Hi to all,
> In my working website user has to download a pdf file once he submits some information.
> No hyperlinks has to show directly file has to download.
>
> I have the idea using hyperlink, that means once user enter details ,it will redirects to another page.
> this is not case.
> It has to download there it self.
>
> Please any one has idea, let help me.
> I am searching for this since last 4-5 hr's.
>
OK, so in order to submit the information, the user has to submit a
form. When he/she submits the form, it goes to a PHP script on your
page which validates the inputted data. If the data is valid, it then
sends the file to the user, with the appropriate headers, i.e.
(Off the top of my head - not checked for syntax):
// $filename contains the complete path and filename of the pdf to send
header("Content-type:application/pdf");
header("Content-Disposition:attachment;filename='".basename($filename)
."'");
header("Content-Length: " . filesize($filename)); // Optional but nice
readfile("$filename");
Note: ensure NOTHING (including white space) is sent before these calls.
You can get more examples from the manual at php.net, look at the
header() function.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Michael Vilain <vilain@NOspamcop.net> |
|---|---|
| Date | 2012-10-16 09:46 -0700 |
| Message-ID | <vilain-60A269.09463516102012@news.individual.net> |
| In reply to | #7332 |
In article <79a88c4d-32a2-4545-86d3-02ec367f365f@googlegroups.com>, Nagender <nagender.goldenslash@gmail.com> wrote: > Hi to all, > In my working website user has to download a pdf file once he submits some > information. > No hyperlinks has to show directly file has to download. > > I have the idea using hyperlink, that means once user enter details ,it will > redirects to another page. > this is not case. > It has to download there it self. > > Please any one has idea, let help me. > I am searching for this since last 4-5 hr's. I'm not sure, based on your broken english, what you're trying to do. You have a form that the user fills out. Then clicks SUBMIT. And you want that form to download a PDF file to the user's browser? Or do you want to display a page that has a link where the user can download the PDF file? Or something else? Doing an automatic download is pretty simple once php has control of interaction, which it will after you click SUBMIT. Send the proper header, mime-type, then open the PDF file you want to send and output it to the browser as a binary file. -- DeeDee, don't press that button! DeeDee! NO! Dee... [I filter all Goggle Groups posts, so any reply may be automatically ignored]
[toc] | [prev] | [next] | [standalone]
| From | Nagender <nagender.goldenslash@gmail.com> |
|---|---|
| Date | 2012-10-17 03:46 -0700 |
| Message-ID | <aae87bf7-b906-4b76-a3f7-bb7c005b6b05@googlegroups.com> |
| In reply to | #7335 |
Thanks for your reply. I will find a solution with this information. Thanks and Regards Nagender.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web