Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Senior Member MYIWDesigns's Avatar
    Join Date
    Apr 2011
    Location
    NY
    Posts
    639
    Member #
    27515
    Liked
    72 times
    Does any one know how to add a file download option after a form has been submitted, preferably an inline option.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Are there particular conditions that have to be met with the form?
    Like they must verify their email address or something?

    What keeps someone from filling out fake information to get the download?

    And what is the download, what type of file?


  4. #3
    Senior Member MYIWDesigns's Avatar
    Join Date
    Apr 2011
    Location
    NY
    Posts
    639
    Member #
    27515
    Liked
    72 times
    I see your point. Well its just a PDF ebook , http://www.myiwdesigns.com/fintrackw/contact
    The one that says get a free ebook. Right now I have a wordpress plugin that does it but , it gives me error sometimes. I would prefer the download to go t there email address

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    What is the filetype of your ebook? .mob?

    If the file is stored on your website, in a directory somewhere, you can just use
    a simple PHP script to download it. When they click on the link, or submit the form,
    a dialog box will open "view or save file". Is that what you're looking for?


  6. #5
    Senior Member MYIWDesigns's Avatar
    Join Date
    Apr 2011
    Location
    NY
    Posts
    639
    Member #
    27515
    Liked
    72 times
    Yes somewhat... I was more going for when they fill out and submit a form . the file is a PDF file .pdf

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Because I don't have any access to your files, I'm not sure where to stick the script below.
    Right now, you have something that does the download after the email. The script will have
    to go in a place where it executes after the email is sent. I don't know how you will determine
    that.

    You can try this script all by itself to test it out.
    You enter your real PDF filename (and path), and then the filename you wish the user to see,
    so you don't have to let them know the real filename.

    PHP Code:
    <?php
    // the real filename and path
    $file="/files/pdf/mypdffile.pdf";

    // what you want the user to see
    $filename "fintrack.pdf";

    header("Content-Type: application/pdf");
    header("Content-Disposition: attachment;filename=$filename");
    header("Content-Transfer-Encoding: binary");
    header("Cache-Control: ");
    header("Pragma: ");
    set_time_limit(0);
    readfile($file);

    ?>


  8. #7
    Senior Member MYIWDesigns's Avatar
    Join Date
    Apr 2011
    Location
    NY
    Posts
    639
    Member #
    27515
    Liked
    72 times
    I did something like this before with scripts I've seen over the internet. It keeps giving a error about "header section already called ......." I'm using WordPress and I had placed that in the header.PHP file above the actually form. Will this give me the same error?

  9. #8
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    Yes it will, it has to be kept to itself.

    You can have a link appear only when the email has been sent.
    If you call the little script "download.php", the link on your WP page
    would be: <a href='download.php'>Download the file now</a>

    That link could be enabled with javascript too.

    Option 2 ... after the email is sent, you redirect to that little script.
    This has to happen in the script that actually sends the email.
    After the email sent ... before anything else is displayed ...
    header("location: download.php");


  10. #9
    Senior Member MYIWDesigns's Avatar
    Join Date
    Apr 2011
    Location
    NY
    Posts
    639
    Member #
    27515
    Liked
    72 times
    OK ill try that and see if it works thanks alot


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

download file after form submission

,

php download file after form submit

Click on a term to search for related topics.
All times are GMT -6. The time now is 10:04 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com