1
tedsmith
Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 9:34

  • tedsmith

  • Home away from home

  • Posts: 1151

  • Since: 2004/6/2 1


How do I configure MIME types for the entire XOOPS system? I know how to do it for the WF-Downloads module, and I expect the WF-Sections module will be the same (when I install it again). But earlier, my user asked why he could not upload a bmp avatar even though I had set users to be able to do so (allowing uploads of avatars). It said that 'the MIME type bmp' was not allowed, but I could not figure out how to change it. I looked at the avatar section itself in admin, but that had no reference to the file types allowed.

Any ideas?

2
CeBepuH
Re: Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 9:58

  • CeBepuH

  • Not too shy to talk

  • Posts: 128

  • Since: 2002/6/10


I think this is the file you need:

class/uploader.php

3
tedsmith
Re: Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 10:08

  • tedsmith

  • Home away from home

  • Posts: 1151

  • Since: 2004/6/2 1


I've looked in that file, and there is indeed many references to the MIMEtypes, but the only area where actual file types are specified are in an area greyed out by comment tags as follows:

// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL:http://www.myweb.ne.jp/,https://xoops.org/,http://www.xoopscube.jp/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //

/*!
Example

include_once 'uploader.php';
$allowed_mimetypes = array
('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'); $maxfilesize = 50000;
$maxfilewidth = 120;
$maxfileheight = 120;
$uploader = new XoopsMediaUploader('/home/xoops/uploads', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
if ($uploader->fetchMedia($HTTP_POST_VARS['uploade_file_name'])) {
if (!$uploader->upload()) {
echo $uploader->getErrors();
} else {
echo '<h4>File uploaded successfully!</h4>'
echo 'Saved as: ' . $uploader->getSavedFileName() . '<br />';
echo 'Full path: ' . $uploader->getSavedDestination();
}
} else {
echo $uploader->getErrors();
}

*/

As far as I understand it, if I change all the values in that bit it will not take any effect. I'm no programmer though!

4
CeBepuH
Re: Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 11:50

  • CeBepuH

  • Not too shy to talk

  • Posts: 128

  • Since: 2002/6/10


uhm, sorry. Stupid mistake

You need to look at edituser.php somewhere around line 271:

if ($op == 'avatarupload') {
    if (!
is_object($xoopsUser) || $xoopsUser->getVar('uid') != $uid ) {
        
redirect_header('index.php',3,_US_NOEDITRIGHT);
        exit();
    }
    if (
$xoopsConfigUser['avatar_allow_upload'] == && $xoopsUser->getVar('posts') >= $xoopsConfigUser['avatar_minposts']) {
        include_once 
XOOPS_ROOT_PATH.'/class/uploader.php';
[
color=FF0000]        $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, [b]array('image/gif''image/jpeg''image/pjpeg''image/x-png''image/png'[/b]), $xoopsConfigUser['avatar_maxsize'], $xoopsConfigUser['avatar_width'], $xoopsConfigUser['avatar_height']);[/color]


I think you should add 'image/bmp', 'image/x-bmp', 'image/x-windows-bmp' but i'm no programmer either


On the other hand this is not global, it's just for uploading avatars

5
tedsmith
Re: Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 12:54

  • tedsmith

  • Home away from home

  • Posts: 1151

  • Since: 2004/6/2 1


It looks like that should have worked, but alas, no joy. I added all three of the extensions you suggested, made sure all the ' and , were in the right place, saved the file, and tried again. Nevermind. It's not vital but thanks anyway for your time.

6
CeBepuH
Re: Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 13:13

  • CeBepuH

  • Not too shy to talk

  • Posts: 128

  • Since: 2002/6/10



I tried it and it worked for me.

I just did a search for mimetypes and it seems there are several additional types. I'm no expert on mimetypes but there seems there are quite a lot more to add for bitmaps. For example there is the Microsoft Windows bitmap which is 'image/x-ms-bmp'. I would suggest further investigating in to that :)

7
Jan304
Re: Changing MIME Types Globally on entire Xoops System
  • 2004/8/17 15:19

  • Jan304

  • Official Support Member

  • Posts: 520

  • Since: 2002/3/31


First of all, I would disadvice allowing bmp files since they are not really an 'internet'-format. And they get way too fast really big in size...

For the mime-types of bmp:
http://filext.com/detaillist.php?extdetail=BMP

Login

Who's Online

248 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 248


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits