1
krystinevo
Formulaire & Mime types

I'm using Formulaire 3.2 and would like to include more file types for the file upload function. (At this point in time, Excel/xls files).

I saw this post here and Philou said to hack the /modules/formulaire/admin/ele_upload.php file, and I did that, and updated the module, however it still doesn't accept Excel files. (I didn't understand the bit about line 165 in the index.php file... I took a look and didn't see a relationship to mime types.)

Here's what I've changed in the ele_upload.php:

$mime = new XoopsFormCheckBox (_AM_ELE_TYPEMIME'ele_value[2]'$tab);
$mime->addOption('pdf',' pdf ');
$mime->addOption('doc',' doc ');
$mime->addOption('txt',' txt ');
$mime->addOption('gif',' gif ');
$mime->addOption('mpeg',' mpeg ');
$mime->addOption('jpg',' jpg ');
$mime->addOption('zip',' zip ');
$mime->addOption('rar',' rar ');
$mime->addOption('xls',' xls ');
$form->addElement($mime);


Any ideas on what else needs to be added in order to add more file types to the upload function? Thanks in advance!

Kristine in Toronto
Everything is as it should be

2
BlueStocking
Re: Formulaire & Mime types

(I didn't understand the bit about line165 in the index.php file...krystinevo
++++++++
see also if there is a problem in the index.php ligne 565....philou

________________________________
Either a typo or maybe you looked in the wrong line number.

https://xoops.org/modules/news/article.php?storyid=2301 << SEE SOURCE LINK for more info.

EXCERPT:
________________________________
Quote:

QUESTION:
Formulaire 3.21 attachment type
This is a very good module. I'm using it for my company's admin work.

I want the user to attach an excel worksheet to a form. However, the xls is not a supported upload type. where can I add xls to the permitted type?

ANSWER:
philou Posted: 2005/8/4 7:57 Updated: 2005/8/4 7:57
XOOPS Management Team


Joined: 2002/5/6
From: France
Posts: 347 Re: Formulaire 3.21 attachment type
for your request about the xls you'll have to hack the file /modules/formulaire/admin/ele_upload.php

$mime = new XoopsFormCheckBox (_AM_ELE_TYPEMIME, 'ele_value[2]', $tab);
$mime->addOption('pdf',' pdf ');
$mime->addOption('doc',' doc ');
$mime->addOption('txt',' txt ');
$mime->addOption('gif',' gif ');
$mime->addOption('mpeg',' mpeg ');
$mime->addOption('jpg',' jpg ');
$mime->addOption('zip',' zip ');
$mime->addOption('rar',' rar ');
$form->addElement($mime);

see also if there is a problem in the index.php ligne 565

you'll have to do some tests of course

I'm working to see if it is possible to store the mime type in the XOOPS version or directly in the admin preferences... for a next release.

for the PM it's no more possible since few version because we can't send attachement to a PM

Have a nice day

Philou


I hope this helps some

A BlueStocking - newbie (IDA)
{wink, grin}
information dissemination attempter

HardHunting.com
hhttps://xoops.org/modules/repository .. It is time to get involved - XOOPS.ORG

3
krystinevo
Re: Formulaire & Mime types

Doh! Thanks Blue. Might help if I read the original post a little more closely At least you've put me in the right ballpark...

Here are lines 565 to 580. I see the commented out lines about file types, but this PHP-clueless n00b needs a little more help in what to change to allow Excel files:

break;
                case 
'upload':
                    
$msg.= "  ".$ele_caption."  "
;
//                    $msg.= "  ".$ele_caption."
  ";
                            /************* UPLOAD *************/
                
$img_dir XOOPS_ROOT_PATH "/uploads/".$modversion['dirname'] ;
                
$allowed_mimetypes = array();
                foreach (
$ele_value[2] as $v){ $allowed_mimetypes[] = 'image/'.$v[1];
                }
                
// types proposés : pdf, doc, txt, gif, mpeg, jpeg, rar, zip

                
$max_imgsize $ele_value[1];
                
$max_imgwidth 12000;
                
$max_imgheight 12000;

                
$fichier $_POST["xoops_upload_file"][0] ;


Thanks in advance,

Kristine in Toronto
Everything is as it should be

4
BlueStocking
Re: Formulaire & Mime types

// types proposés : pdf, doc, txt, gif, mpeg, jpeg, rar, zip

________________________________

it APPEARS to me the xls needs to be added in exactly the same format as the others.

I am assuming the other file formats work ok.

So if it were me, I would try adding a comma after the zip and a space xls

the line would read...

// types proposés : pdf, doc, txt, gif, mpeg, jpeg, rar, zip, xls

________________________________

IF YOU HAVE ANY RESERVATIONS about that check with someone else before making the change. I recommend ALWAYS keeping the original file by renameing it and making any corrections on the copy you intend to replace it with.

Good luck,
BlueStocking
hhttps://xoops.org/modules/repository .. It is time to get involved - XOOPS.ORG

5
krystinevo
Re: Formulaire & Mime types

Changed that line, updated the module and still no go... any other ideas/suggestions?
Everything is as it should be

Login

Who's Online

359 user(s) are online (267 user(s) are browsing Support Forums)


Members: 0


Guests: 359


more...

Donat-O-Meter

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

Latest GitHub Commits