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

  • Home
  • SEARCH
  • 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 9116141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:36:02+00:00 2026-06-17T04:36:02+00:00

Possible Duplicate: How to change the filename displayed in the Save as… dialog from

  • 0

Possible Duplicate:
How to change the filename displayed in the “Save as…” dialog from .php to .png

My PHP-generated GUI displays a dynamically-generated PNG image:

<img src="someScript.php?dataId=xyz&width=250&height=200" alt="Chart" />

The image contents are dynamic and unique based on the dataId argument:

<?php
header('Content-Type: image/png');
// output image based on $_GET['dataId']
?>

But when my users try to right-click and Save As in IE, Firefox or Chrome, the suggested filename is someScript.php.png. This is non-unique and not very useful.

How can I "hint" to browsers as to what the "save as" filename should be?

Browsers can always do what they like, but the precedent set by HTTP’s Content-Disposition: attachment; filename=<filename> implies to me that there may be some way of hinting at a filename. This HTTP header itself is not appropriate because the I want the Content-Disposition to remain at the default of inline.

  • 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-17T04:36:03+00:00Added an answer on June 17, 2026 at 4:36 am

    The filename argument is also supported for Content-Disposition: inline:

    [RFC6266]: 4.3. Disposition Parameter: ‘Filename’

    The parameters "filename" and "filename*", to be matched case-insensitively, provide information on how to construct a filename for storing the message payload.

    Depending on the disposition type, this information might be used right away (in the "save as…" interaction caused for the "attachment" disposition type), or later on (for instance, when the user decides to save the contents of the current page being displayed).

    So:

    <?php
    $filename = "image_" . $_GET['dataId'] . ".png";
    
    header("Content-Type: image/png");
    header("Content-Disposition: inline; filename=\"{$filename}\"");
    
    // output image based on $_GET['dataId']
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to change appearance of URL from within a PHP script I
Possible Duplicate: change layout and template in zend dynamically according to the device(android tab,iphone,ipad)
Possible Duplicate: Android Button: set onClick background image change with XML? I need that
Possible Duplicate: Change tag attribute value with PHP DOMDocument How can i use PHP
Possible Duplicate: How to change window title from a frame in javascript? In my
Possible Duplicate: How to change the URL displayed in the browser without leaving the
Possible Duplicate: how to change column datatype from character to numeric in postgresql 8.4
Possible Duplicate: Change custom color for Rectangle.Fill or Grid.Background I'm trying to dynamically set
Possible Duplicate: How to change last letter of filename to lowercase if it is
Possible Duplicate: change image on click of button in objective c i draged 3

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.