W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > February 2011

[Bug 12123] New: File Streaming

From: <bugzilla@jessica.w3.org>
Date: Fri, 18 Feb 2011 18:06:28 +0000
To: public-html-bugzilla@w3.org
Message-ID: <bug-12123-2486@http.www.w3.org/Bugs/Public/>

           Summary: File Streaming
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: jackalmage@gmail.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,

(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>

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Friday, 18 February 2011 18:06:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:01:41 UTC