Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7797975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:51:44+00:00 2026-06-01T23:51:44+00:00

I am using the php to generate some html codes It is in the

  • 0

I am using the php to generate some html codes

It is in the now ,

<textarea>
<html>
....
</html>
</textarea>

what i would like to do is create a button ‘save as html’

When i press on it, it has a windows save as dialog, allow user choose the place to store,

then save to that place when confirm (the dialog should not be create by me, using the windows one.)

Is the workflow is : first i saved a temp html file in my server, then the user open dialog, (I do not need to worry about the ‘saving to part’ , just need to specific the temp html file path), and when the user close, i delete the temp file. So , how can it be realize? thanks

Thank you again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:51:45+00:00Added an answer on June 1, 2026 at 11:51 pm

    PHP is on the server-side don’t forget. Once the page is generated, it is on the client. I think it makes more sense to do this sort of thing with javascript, although you could also post the data to a PHP page which would then obtain the data.

    Send the ‘input’ data to a PHP page by POST method:

    <form action="savedata.php">
         <input id="someElement" name="someElementName" type="textarea" />
         <input type="submit" />
    </form>
    

    Receive it on the PHP end:

    # savedata.php
    
    $inputdata = $_POST["someElementName"];
    $filename = "somefile.html";
    file_put_contents($filename, $inputdata);
    

    Then you could have a link in PHP to download the file.

    echo "<a href='".$filename."'>Right-click, Save Target As...</a>";
    

    After that you can delete the file from your server like this:

    unlink($filename);
    

    To open a save file dialog – redirect to the file, your browser should open up a save file dialog:

    header('Content-type: text/plain'); 
    header('Content-disposition: attachment; filename="$filename"'); 
    

    To view a preview of the file, make an iframe:

    echo "<iframe src='$filename' width=600 height=200 frameborder=0 />";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using http://www.ashberg.de/php-barcode/ scripts to generate a barcode. I now need to import the
This piece of valid json (it has been generated using php's json_encode): {html:form is
I've developed some web-based applications till now using PHP, Python and Java. But some
I'm looking to create on-the-fly tree diagrams using PHP, HTML, and CSS. Mock-up below:
I'm making a XHTML Page, and i'm using php to generate it. So, now
whenever we include\require some file using php like require ('links.php'); OR include ('links.php'); which
Some years ago I created a small website in PHP that now has grown
I have a PHP script that I am using to generate some rather complicated
I'm using php to generate an html page that displays blog/thread items, and I
I'm using PHP to generate feeds, which is working perfectly fine on my local

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.