RE: offering downloads of blobs (mysql) with php

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 30 Apr 2011 01:33:10 -0400

Sure, there is, MP3, wave, avi, exe: they all have appropriate mime types. Just 
look them up.

Take care,
Sina


-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall
Sent: Friday, April 29, 2011 10:20 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: offering downloads of blobs (mysql) with php

Okay, I think I see. So is there an easy way to know, based (I assume)
on the file extension, what mime type to use? I imagine there is some
hard coded array of types maintained somewhere for common extensions.
For example:
$type=someArray[$extension'];
I know associative arrays don't work quite like that in php, but you
get the idea.

On 4/29/11, Sina Bahram <sbahram@xxxxxxxxx> wrote:
> The script you found is doing it correctly. There is no file to serve, so no
> link can be generated to a file; however, a link can be
> generated to a page such as one written in PHP or other dynamic language
> that can grab a blob from a database and then stream that
> file, if you will, to the user, as if it was a file on the disk; however,
> since it's not a file, you have to indicate things like
> mime type to let the browser and receiver know what is being received.
>
> I'd recommend starting here:
>
> http://en.wikipedia.org/wiki/Internet_media_type
>
> take care,
> Sina
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Alex Hall
> Sent: Friday, April 29, 2011 8:35 PM
> To: programmingblind
> Subject: offering downloads of blobs (mysql) with php
>
> Hi all,
> I have a database project due next Wednesday. It is done, but I am
> adding things since I have the time (and I really don't want to do my
> calc homework right now). One of my databases is for podcasts, the
> other for articles. The articles one is fine; I can serve that content
> since it is stored in a longtext field, so I need only echo it to the
> page. The podcast table is different, though. I looked up this stuff
> already, but was taken to a script that was using a header() function
> (php) and giving it mime information about the file, then it echoed
> the blob, and that was it. I am wondering:
> 1. What is all this mime stuff about?
> 2. My only experience with files and webpages is putting a link to a
> file, even a binary one, and letting the browser take care of it. Why,
> then, did the script I found echo the blob and leave it at that? It
> was not generating an html page with a link; the link was to
> download.php, and download.php was the one doing all this with the
> mime information and the echoing of the blob.
> 3. Does anyone know of a good resource to find out more about serving
> blobs so users can download them? Most of what I find is about
> displaying images stored as blobs, but I want to offer a download link
> for a given podcast's media file.
> Thanks in advance.
>
> --
> Have a great day,
> Alex (msg sent from GMail website)
> mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: