[thelist] CD-ROM question

Kasimir K evolt at kasimir-k.fi
Tue Nov 22 03:51:44 CST 2005


>> In PHP I used to use the header() function, set the content-type to
>> "application/octet-stream" and open the file in the page - 

Shawn K. Quinn scribeva in 2005-11-22 05:20:
> You mean, violating the HTTP specification and *lying* to the browser
> about what it is really being served? This type of approach *will* cause
> problems for users sooner or later.

Fully agree with Shawn here - not a good idea to make untrue statements 
(not between persons nor software :-)

A far better approach for server side is along the lines of:
header("Content-type: image/" . $format);
header("Content-Disposition: inline; filename=$imgName.$format");

While "Content-Disposition:"[0] isn't really part of HTTP standard, it 
is in wide use.

>> a CD I can't use server-side technology.

So the above won't help :-)

>> Does anyone know of a way javascript could do a similar thing? perhaps
>> document.open() or similar?
> 
> I don't know much Javascript but I don't think this will solve your
> problem.

I know a bit more, and agree.

> How would I solve this problem? Actually, it's already been solved; at
> least Firefox has "save image as..." in the right click menu.

That is a good solution to the this problem.

... but hold, what *is* the problem? Isn't is that we show images 
through a web browser to the user, and they should be able to save those 
images on their local system? But the images *are* already on their 
local system - assuming the CD is in their CD-drive, not on a CD-changer 
in the server hall :-)

So it appears the problem is the solution itself. Just provide the users 
with instruction like "You can access the images on the CD-ROM's 
directory /the/path/to/images/".


.k


[0] http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1



More information about the thelist mailing list