This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12123 - File Streaming
Summary: File Streaming
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2011-02-18 18:06 UTC by Tab Atkins Jr.
Modified: 2011-08-04 05:01 UTC (History)
5 users (show)

See Also:


Description Tab Atkins Jr. 2011-02-18 18:06:27 UTC
(This bug was split out from

File tag <file></file> and FILE STREAMING
This is the most important suggestion. 
Currently, server side technologies exist for dynamically generating content
that can be displayed in browsers. E.g. images
The problem here is no client side technology is available to support dynamic
content generation.
For better understanding, I will start with a problem statement

I have a PHP script that dynamically generates a chart in form of a GIF image.
I can point the SRC attribute of an image tag to this
PHP script but there is no standard way for the browser to handle this, so
while one browser will reject the image because it does
not recognise ".php" as an image extension, another browser will ask the user
if they want to save the file (download it).
In PHP, there is an extension called GD that can be used to dynamically
generate images at runtime, however to send this image to
the browser, the image first has to be saved to a file on the server (this has
an overhead), then an image tag is sent to the browser
with the SRC attribute set to the location of the image file. This places
restrictions on the use of dynamically generated files.
It is important to note that dynamically generated files are not only limited
to images, flash, PDF and other files can also be generated
dynamically. Currently only static files are supported.

The file tag is an attempt to provide a solution to this problem.
The file tag provides a standard way for dynamically generated content to be
sent to the client directly (streamed).
Description : A file tag is a container for dynamically generated and streamed
A file tag is a generic container that can host any type of file. The server
side script first sends a mime-type header to inform client
of the kind of file client should be expecting / will be receiving. Files are
displayed through the use of plugins or inbuilt browser
Although there are special tags to handle various file types (<img>, <audio>,
<video>), having one tag that is file type
independent and relies mostly on plugins to display files removes to necessity
to add file streaming support to each tag
that hosts files.

How It Works
I add a file tag to my HTML page and set the "SRC" to a PHP script or any
server side script. This script is called and it first sends
a mime type header followed by dynamically generated content. Browser uses
mime type to be able to display file. Browser might
have native capacity to display file or it may have a plugin installed which
it uses to display file. Where the browser does not have
a plugin installed that can display file and a native capacity to display
file, the user is informed that browser cannot display file and
is given the option of saving file to disk to open later with an appropriate
Also, dynamically generated content can also be streamed inbetween the file
I.E. Instead of setting the "SRC" attribute to a server side script, the
server side script can simply echo the beginning file tag <file>,
echo the mime type header, echo the dynamically generated content and then
echo the closing tag </file> . It works either way.

The file object created from a file tag exposes certain methods and properties

- ispluginused (boolean property) : is true if a plugin is currently used to
display the contents of file tag.
- getplugin() : a method called to get a reference to plugin object if object
exposes it self to javascript.
   returns the plugin object on success and false on failure
- Load($url) : Current file content is unloaded and new content is loaded by
calling server side script pointed to by $url
- Refresh() : Reloads content from current url.

1 )Static files : are files saved on the server which are sent to the client
upon request. Static files are usually generated using
3rd party software and are then saved on the server. They are hardly changed
after being saved on the server. And a change will
require human interaction.

2 )Streamed files : are files that are generated dynamically by server side
scripts and streamed (sent) directly to the client
(browser). They are not normally saved to the server although they can be.

A PHP script that dynamically generates an image or PDF file can send it to
the browser in a standard way without having to save
it to disk on the server. The client will also understand and be able to
display file.
The file tag does not introduce any new file type, it is just a standard way
for the browser to receive streamed files.

$image = imagecreatefrompng("images/picture.png"); // image is fetched from
file because this is an illustration of file tag not dynamic image generation
echo "<file>";
echo "mime-type:image/png";
echo "</file>";


// image.php
$image = imagecreatefrompng("images/picture.png");
echo "mime-type:image/png";

// image.html (part)
<file src="image.php"></file>
Comment 1 Tab Atkins Jr. 2011-02-18 18:11:51 UTC
The basic problem elucidated in this bug ("one browser will reject the image because it does not recognise '.php' as an image extension, another browser will ask the user if they want to save the file (download it).") is false.  No browser sniffs images based on file extension, particularly the .php extension which is commonly used for dynamic images.

Further, the browser makes no distinction between "static" and "dynamic" content in the way that this bug suggests.

All of the examples given in this bug can be achieved today using the exact same PHP and the <img> element.
Comment 2 Ian 'Hixie' Hickson 2011-05-04 23:32:28 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:

Status: Rejected
Change Description: no spec change
Rationale: The problem as described is false. There is a standard way to process dynamically-generated files: the exact same way as statically-generated files. Browsers can't tell the difference.
Comment 3 Michael[tm] Smith 2011-08-04 05:01:49 UTC
mass-moved component to LC1