KissGallery
Moderator: Tata
KissGallery
Hi I have installed KissGallery 4 plugin on cmsimple 3.2
.
When enver I want to upload the picture I get error "Wrong extension in "
this is the error catcher in admin.php
if (!(preg_match($ext, $file_name))) $e.='<li>'.$tx['error']['wrongext'].' '.$file_name.'</li>';
I took a look at the code and I saw that variable file_name is always empty
.
$files=kissRFile($fnfile);
if ($action=='save_file') {
$order=kissGetNumber(kissGetVar('order'));
$file_name=kissGetVar('file_name');
$desc=strtr(kissGetVar('desc'),"#","_");
if ($id==0) {
$file_name = strtolower($GLOBALS['HTTP_POST_FILES']['file_name']['name']);
if ($desc=='') $desc=$file_name;
if ($order=='') $order=time();
$file_size = $GLOBALS['HTTP_POST_FILES']['file_name']['size'];
$file_tmp = $GLOBALS['HTTP_POST_FILES']['file_name']['tmp_name'];
$file_type = $GLOBALS['HTTP_POST_FILES']['file_name']['type'];
$ext='/\\'.str_replace(',','|\\',$plugin_cf['kissgallery']['file_extension']).'/i';
if (!(preg_match($ext, $file_name))) $e.='<li>'.$tx['error']['wrongext'].' '.$file_name.'</li>';
if ($file_size > $plugin_cf['kissgallery']['max_filesize']) $e .= '<li>'.$file_name.' '.$tx['error']['tolarge'].' '.$plugin_cf['kissgallery']['max_filesize'].' '.$tx['files']['bytes'].'</li>';
if (!$e) {
$id=kissNextID($files);
if (getImage($file_tmp,$id,$filepath)) {
$o .= '<p>'.ucfirst($tx['filetype']['file']).' '.$file_name.' '.$tx['result']['uploaded'].'</p>';
$file_datetime=time();
$files[]=array($id,$order,$gid,$file_name,$file_datetime,$file_type,$desc);
}
else e('cntsave', 'file', $file_name);
}
} else {
foreach ($files as $num => $rec) {
if ($rec[0]==$id) {
$files[$num][1]=$order;
$files[$num][2]=$gid;
$files[$num][6]=$desc;
}
}
}
kissWFile($fnfile,$files);
$files=kissRFile($fnfile);
}
Did any one have same problem
.
When enver I want to upload the picture I get error "Wrong extension in "
this is the error catcher in admin.php
if (!(preg_match($ext, $file_name))) $e.='<li>'.$tx['error']['wrongext'].' '.$file_name.'</li>';
I took a look at the code and I saw that variable file_name is always empty
.
$files=kissRFile($fnfile);
if ($action=='save_file') {
$order=kissGetNumber(kissGetVar('order'));
$file_name=kissGetVar('file_name');
$desc=strtr(kissGetVar('desc'),"#","_");
if ($id==0) {
$file_name = strtolower($GLOBALS['HTTP_POST_FILES']['file_name']['name']);
if ($desc=='') $desc=$file_name;
if ($order=='') $order=time();
$file_size = $GLOBALS['HTTP_POST_FILES']['file_name']['size'];
$file_tmp = $GLOBALS['HTTP_POST_FILES']['file_name']['tmp_name'];
$file_type = $GLOBALS['HTTP_POST_FILES']['file_name']['type'];
$ext='/\\'.str_replace(',','|\\',$plugin_cf['kissgallery']['file_extension']).'/i';
if (!(preg_match($ext, $file_name))) $e.='<li>'.$tx['error']['wrongext'].' '.$file_name.'</li>';
if ($file_size > $plugin_cf['kissgallery']['max_filesize']) $e .= '<li>'.$file_name.' '.$tx['error']['tolarge'].' '.$plugin_cf['kissgallery']['max_filesize'].' '.$tx['files']['bytes'].'</li>';
if (!$e) {
$id=kissNextID($files);
if (getImage($file_tmp,$id,$filepath)) {
$o .= '<p>'.ucfirst($tx['filetype']['file']).' '.$file_name.' '.$tx['result']['uploaded'].'</p>';
$file_datetime=time();
$files[]=array($id,$order,$gid,$file_name,$file_datetime,$file_type,$desc);
}
else e('cntsave', 'file', $file_name);
}
} else {
foreach ($files as $num => $rec) {
if ($rec[0]==$id) {
$files[$num][1]=$order;
$files[$num][2]=$gid;
$files[$num][6]=$desc;
}
}
}
kissWFile($fnfile,$files);
$files=kissRFile($fnfile);
}
Did any one have same problem
Re: KissGallery
a similar (or the same) question has been posted already
there is no need to post the complete script code, better would be to know the name of the image which you tried to upload
"Wrong extension in" points to a file-name-permission-problem
so please give us the information which filename you used when you wanted to upload a file
there is no need to post the complete script code, better would be to know the name of the image which you tried to upload
"Wrong extension in" points to a file-name-permission-problem
so please give us the information which filename you used when you wanted to upload a file
|---
Connie Müller-Gödecke, http://www.webdeerns.de
Connie Müller-Gödecke, http://www.webdeerns.de
Re: KissGallery
I was uploading one test image from my computer
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg
Re: KissGallery
One more thing
If I am uploading same picture with CMSimple images option it works perfectly.
If I am uploading same picture with CMSimple images option it works perfectly.
Re: KissGallery
ok, so it can't be a disallowed file format or file-extension
check this:
1. what is the maximum-filesize which is defined in your CMSimple-configuration? This value relates to the standard-image-upload
2. what is the maximum-filesize which is defined for kiss gallery?
see here: \config\config.php
3. what is the filesize of the image you tried to upload?
It it is lower/equal the configuration-size but greater than the gallery-config-size you have the reason why...
check this:
1. what is the maximum-filesize which is defined in your CMSimple-configuration? This value relates to the standard-image-upload
2. what is the maximum-filesize which is defined for kiss gallery?
see here: \config\config.php
Code: Select all
$plugin_cf['kissgallery']['max_filesize']="1000000";
It it is lower/equal the configuration-size but greater than the gallery-config-size you have the reason why...
Last edited by Connie on Thu Dec 11, 2008 12:22 pm, edited 1 time in total.
|---
Connie Müller-Gödecke, http://www.webdeerns.de
Connie Müller-Gödecke, http://www.webdeerns.de
Re: KissGallery
So how can I solve this problem?
Re: KissGallery
Hi maco & Connie,
(So it was very helpfull to post the code here )
IMHO the problem belongs to the use of the $GLOBALS * VARS.
$HTTP_POST_FILES is deprecated since PHP Version 4.1.0. To access this variables, you need the setting register_long_arrays = on.
The author should rewrite the script to use the superglobals: http://de.php.net/manual/en/language.va ... lobals.php
As a quick and dirty solution, to keep such scripts alive, it should help to include a code-snippet like this at the top of the script(s):
But it's better to replace all $GLOBALS['HTTP_POST_FILES'] with $_FILES !
WBR
Holger
Connie wrote:"Wrong extension in" points to a file-name-permission-problem
That's not a problem with a file-extention, sizes or a wrong permission. It's a problem with the script and the PHP version & settings.maco wrote:I saw that variable file_name is always empty
(So it was very helpfull to post the code here )
IMHO the problem belongs to the use of the $GLOBALS * VARS.
$HTTP_POST_FILES is deprecated since PHP Version 4.1.0. To access this variables, you need the setting register_long_arrays = on.
The author should rewrite the script to use the superglobals: http://de.php.net/manual/en/language.va ... lobals.php
As a quick and dirty solution, to keep such scripts alive, it should help to include a code-snippet like this at the top of the script(s):
Code: Select all
$HTTP_POST_VARS = !empty($HTTP_POST_VARS) ? $HTTP_POST_VARS : $_POST;
$HTTP_GET_VARS = !empty($HTTP_GET_VARS) ? $HTTP_GET_VARS : $_GET;
$HTTP_POST_FILES = !empty($HTTP_POST_FILES) ? $HTTP_POST_FILES : $_FILES;
$HTTP_COOKIE_VARS = !empty($HTTP_COOKIE_VARS) ? $HTTP_COOKIE_VARS : $_COOKIE;
$HTTP_SERVER_VARS = !empty($HTTP_SERVER_VARS) ? $HTTP_SERVER_VARS : $_SERVER;
WBR
Holger
Re: KissGallery
If I do the above then file upload is not working at all
-
-
Re: KissGallery
Hmm, like before ... (what do you mean with "not working at all"?)maco wrote:If I do the above then file upload is not working at all
-
As I said, it should work.
Edit:
Yes it's clear. Since we're speaking about arrays, we have to extract each value of these arrays, of course.
But I would prefer to rewrite the script - as mentioned above - to use $_FILES.
Holger
Re: KissGallery
Have you tried to search'n replace $GLOBALS['HTTP_POST_FILES'] with $_FILES ?
I bet that's the problem when $file_name is empty.
What's the setting of "register_long_arrays" in your php.ini?
Holger
I bet that's the problem when $file_name is empty.
What's the setting of "register_long_arrays" in your php.ini?
Holger