0

Hey Guys, u I am using mogilefs to store files on a storage cluster. And i want to offer a download link to users. Only when i run getPaths on mogileFS it returns something like:

http://10.0.0.23:7500/dev11/0/422/711/0494715033.fid

i can rename the .fid to the actual file extension, but how do i offer the original file for download to the user? Can i force the file somehow with php? (Without using readfile or anything, the files are there for bandwidth reasons).

thnx guys

thecodeassassin
  • 816
  • 10
  • 24

2 Answers2

1

How does that URL respond? If it is HTTP, than no problem, it will set the mime-type, although you have to set Content-Disposition... If it's not HTTP, than you have to make a wrapper which responds HTTP to the HTTP request.

You should first try: what does the link respond (headers) ?

If you have to modify the headers, than it must use some kind of proxy.

gthomas
  • 77
  • 2
  • i think it returns HTTP... because it downloads the file with the correct mime-type. So how do i rewrite the filename? Without putting load on my PHP server> i've tried setting the headers like this: http://pastebin.com/0kPPJcXy – thecodeassassin Mar 25 '11 at 14:10
1

Here you are http://www.grid.net.ru/nginx/mogilefs.ru.html

How it works:

all requests with /storage/mogileKey are served from mogile storage with nginx webserver

all other request you can easily proxy to your apache listening :not80port (:88 for example)

while stoaring file to mogilefs give it a key with required extension: myimage.jpg ...

When your request will look like normal: /storage/myimaje.jpg and will served from /devN/path/to/mogile/file.fid