We are currently upgrading the infrastructure of the .org community. We appreciate your patience as some features may be disabled or not working temporarily. More details here
View instead of download?
This discussion is related to the FileUpload
Hi, I could use some advice.
I'm trying to get the file upload plugin to display
attachments instead of downloading them when you click on their link. I'm working with mp3's & images mostly.
1) I hade to make some changes in the Vanilla core files. I changed 'attachment' to 'inline' on line 294 of core/class.filesystem.php:
public static function ServeFile($File, $Name = '', $MimeType = '', $ServeMode = 'inline')
I also fixed/added some mime-types around line 330:
"jpeg"=> "image/jpeg", // Edited line; added e to jpeg.
"jpg" => "image/jpeg", // Edited line; added e to jpeg.
"mp3" => "audio/mpeg" // Added line.
I now have the images working, and mp3s look like they are going to load, but I just get a Quicktime question mark icon. When I force download an mp3, it works, but Safari displays ? for file size until it finishes.
I tried adding this around line 360, but seems to have no effect:
Is there a better way to go about this? Editing a core php file to support a plugin featue feels fragile. Any ideas for getting the mp3 to play? I know Safari is a little touchy with file headers sometimes, but it's able to play most mp3s in browser.
0 · ·