1
tvn3015
mxdirectory error in uploading logo
  • 2007/12/4 8:11

  • tvn3015

  • Just popping in

  • Posts: 53

  • Since: 2007/4/18


I submit my listings and try to upload pics for logo, the "logo.gif" is uploading file but "logo.jpg" and "logo.png" is error out with the following message:
Quote:
Only png, gif, or jpg !!!

And I was making sure that the logo size is within limit and the folder permision is right. Any suggestion?

TVN
hhttp://www.XoopsViet.com - Xoops for Vietnamese

2
tvn3015
Re: mxdirectory error in uploading logo
  • 2007/12/5 5:09

  • tvn3015

  • Just popping in

  • Posts: 53

  • Since: 2007/4/18


Just post this code here if anyone see anything wrong with this code below.

Quote:

$domain = XOOPS_URL;
$path = './images/shots/'; //path to targetfolder
$path_after_domain = '/modules/' . $mydirname . '/images/shots/'; //path to targetfolder for use in url
$max_size = $xoopsModuleConfig['logo_maxfilesize']; //maximum filesize
$ferror = false;
if ((isset($_FILES['logoup'])) && (is_uploaded_file($_FILES['logoup']['tmp_name'])))
{
if ($_FILES['logoup']['size']>$max_size)
{
$ferror = _MD_ELOGOSIZE; // file too big
}
else
{
if (($_FILES['logoup']['type']=='image/gif') || ($_FILES['logoup']['type']=='image/png') || ($_FILES['logoup']['type']=='image/jpeg')) {
if (file_exists($path . $_FILES['logoup']['name'])) {
$ferror = _MD_ELOGOSAMENAME; // file exists
} else {
if (!copy($_FILES['logoup']['tmp_name'], $path .$_FILES['logoup']['name'])) {
$ferror = _MD_ELOGOTEMP;
}
}
} else {
$ferror = _MD_ELOGOTYPE; // wrong file type
}
}
hhttp://www.XoopsViet.com - Xoops for Vietnamese

3
tvn3015
Re: mxdirectory error in uploading logo
  • 2007/12/10 18:08

  • tvn3015

  • Just popping in

  • Posts: 53

  • Since: 2007/4/18


Got it working now! Teach myselft some php code from the internet and basicly rewrite the code above and it work! Check it out Here
hhttp://www.XoopsViet.com - Xoops for Vietnamese

4
srisree
Re: mxdirectory error in uploading logo
  • 2008/9/2 4:55

  • srisree

  • Just popping in

  • Posts: 11

  • Since: 2003/2/7 9


Hello

Can you please share how you solved mxdirectory photo upload problem

regards

5
zeroram
Re: mxdirectory error in uploading logo
  • 2009/11/28 7:05

  • zeroram

  • Friend of XOOPS

  • Posts: 326

  • Since: 2004/6/30


wow, he posted the error. got the code working and didnt show the fix... lame

6
tomodea
Re: mxdirectory error in uploading logo
  • 2010/3/6 2:15

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I also struck this problem and I'm happy to share my solution.

My analysis shows that there is a logic error in one of the PHP script files.

The PHP script used to submit a new listing is called submit.php. The logic includes a test to check that the maximum file size is not exceeded. The PHP script to handle updates is called modlink.php. This also includes a test to check that the maximum file size is not exceeded. However, it was testing against the maximum image width instead of the maximum file size. Since the maximum image width in my case is set to 300, this will produce an error every time.

Here is the line of code in submit.php:
$modlinkform->addElement(new XoopsFormFile(_MD_LOGOUP 'logoup'$xoopsModuleConfig['logo_maxfilesize']));


Here is the line of code that was in modlink.php:
$modlinkform->addElement(new XoopsFormFile(_MD_LOGOUP'logoup',$xoopsModuleConfig['logo_maximgwidth']));


The solution is to simply change logo_maximgwidth to logo_maxfilesize.

7
sailjapan
Re: mxdirectory error in uploading logo

Thanks for sharing!

8
tomodea
Re: mxdirectory error in uploading logo
  • 2010/3/11 11:48

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I discovered another error in mxdirectory image uploading.

The error message "Only png, gif, or jpg !!!" should only appear if you are trying to upload an image which is not a proper image file (png, gif or jpg). We were trying to upload a jpg file so it should be accepted. The mxdirectory module tests for image/gif, image/png or image/jpeg. This is fine under Firefox but not if you are using Internet Explorer.

If you are using Internet Explorer and you try to upload a jpg file then the file is treated as a pjpeg file and we need to test for this file type as well as the other possible file types.

The solution is to update these files:
modlink.php
submit.php
admin/index.php

Look for this statement:
if (($_FILES['logoup']['type']=="image/gif") || ($_FILES['logoup']['type']=="image/png") || ($_FILES['logoup']['type']=="image/jpeg")) {


Change it to:
if (($_FILES['logoup']['type']=="image/gif") || ($_FILES['logoup']['type']=="image/png") || ($_FILES['logoup']['type']=="image/jpeg") || ($_FILES['logoup']['type']=="image/pjpeg")) {


Login

Who's Online

358 user(s) are online (229 user(s) are browsing Support Forums)


Members: 0


Guests: 358


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