After pressing the send buttun I get this message:
Warning: chmod() [function.chmod]: Inappropriate file type or format. line 561 of chronocontact.php.
I tried to find the line $mosConfig_fileperms = ''; in my config.php as described in thried #5260, but I can't find it. In my config.php is eveything
var __something__
Maybe it's becouse i have Joomla 1.5 installed?
I have the latest chronoengine as well, so it should be ready for joomla 1.5 I guess...
Can someone help me out?
PS. Everything works fine though. email is send, files are uploaded... no problem there but the warning.
Warning: chmod() [function.chmod]: Inappropriate file type or format. line 561 of chronocontact.php.
I tried to find the line $mosConfig_fileperms = ''; in my config.php as described in thried #5260, but I can't find it. In my config.php is eveything
var __something__
Maybe it's becouse i have Joomla 1.5 installed?
I have the latest chronoengine as well, so it should be ready for joomla 1.5 I guess...
Can someone help me out?
PS. Everything works fine though. email is send, files are uploaded... no problem there but the warning.
Hi jerre,
Yes the config file in Joomla 1.5 is different.
The warning comes up when ChronoForms tries to set the file permissions for the uploaded file.
You should have '$fileperms = "0644";' at line 548 or thereabouts, this should prevent this warning. The code block I have is:
Yes the config file in Joomla 1.5 is different.
The warning comes up when ChronoForms tries to set the file permissions for the uploaded file.
You should have '$fileperms = "0644";' at line 548 or thereabouts, this should prevent this warning. The code block I have is:
function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = FALSE)
{
//global $mosConfig_absolute_path, $mosConfig_fileperms;
$fileperms = "0644";
if ( strlen($mosConfig_fileperms) > 0 ) {
$fileperms = octdec($mosConfig_fileperms);
}
$uploaded_files = "";
$upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
if ( is_file($uploadedfile) ) {
$targetfile = $upload_path.$filename;
while ( file_exists($targetfile) ) {
$targetfile = $upload_path.rand(1,1000).'_'.$filename;
}
move_uploaded_file($uploadedfile, $targetfile);
if ( strlen($fileperms) > 0 ) {
chmod($targetfile, $fileperms);
}
$uploaded_files = $targetfile;
}
return $uploaded_files;
}
Bob
hank you for your replay.
I looked into my file, but it's exactly the same as yours. Including the
$fileperms = '0644';
This is from my file:
I see no difference.
But I tried something else though; I just cut out all this;
Now it works without the warning message. Everything seems to work just fine, but since I don't know php, I am not sure what I took out, and if it can do any harm...
Post edited by: jerre, at: 2008/03/11 00:02<br><br>Post edited by: jerre, at: 2008/03/11 00:04
I looked into my file, but it's exactly the same as yours. Including the
$fileperms = '0644';
This is from my file:
function handle_uploaded_files($uploadedfile, $filename, $limits = TRUE, $directory = FALSE)
{
//global $mosConfig_absolute_path, $mosConfig_fileperms;
$fileperms = "0644";
if ( strlen($mosConfig_fileperms) > 0 ) {
$fileperms = octdec($mosConfig_fileperms);
}
$uploaded_files = "";
$upload_path = JPATH_SITE.'/components/com_chronocontact/upload/';
if ( is_file($uploadedfile) ) {
$targetfile = $upload_path.$filename;
while ( file_exists($targetfile) ) {
$targetfile = $upload_path.rand(1,1000).'_'.$filename;
}
move_uploaded_file($uploadedfile, $targetfile);
if ( strlen($fileperms) > 0 ) {
chmod($targetfile, $fileperms);
}
$uploaded_files = $targetfile;
}
return $uploaded_files;
}
I see no difference.
But I tried something else though; I just cut out all this;
if ( strlen($fileperms) > 0 ) {
chmod($targetfile, $fileperms);
Now it works without the warning message. Everything seems to work just fine, but since I don't know php, I am not sure what I took out, and if it can do any harm...
Post edited by: jerre, at: 2008/03/11 00:02<br><br>Post edited by: jerre, at: 2008/03/11 00:04
Hi jerre,
It probably won't do any harm. You do need to take out the closing bracket as well. You can do it by commenting out the block:
Bob
It probably won't do any harm. You do need to take out the closing bracket as well. You can do it by commenting out the block:
/* commented out to prevent error
if ( strlen($fileperms) > 0 ) {
chmod($targetfile, $fileperms);
}
*/
It is only a warning so it's inconvenient rather than dangerous. It will probably go away if you set your Site Error Reporting to Stsem Default.
Bob
Thats fine, this code block will just check to see if you have some special permissions set for new file uploads at your global config and set those permissions to files uploaded with the form, taking it out is fine as long as it does what you need🙂
Cheers,
Max
Cheers,
Max
Thanks all for your kind advise.
I'll leave the block out, it workes without any trouble.
So, I would say; case solved :-)
Thanks again!
I'll leave the block out, it workes without any trouble.
So, I would say; case solved :-)
Thanks again!
There is a common php mistake in chmod() usage, as is in
chmod($targetfile, $fileperms);
Bare in mind that the second parameter of the function must be a integer and not a string !!!
So use:
(somewhere line 550 on file chronocontact.php)
That will solved this bug.
See also:
http://www.chronoengine.com/component/option,com_fireboard/Itemid,37/func,view/catid,5/id,7216/#7216<br><br>Post edited by: Actor, at: 2008/04/04 02:46
chmod($targetfile, $fileperms);
Bare in mind that the second parameter of the function must be a integer and not a string !!!
So use:
$fileperms=0644; // octal format
(somewhere line 550 on file chronocontact.php)
That will solved this bug.
See also:
http://www.chronoengine.com/component/option,com_fireboard/Itemid,37/func,view/catid,5/id,7216/#7216<br><br>Post edited by: Actor, at: 2008/04/04 02:46
Thanks Actor!!
Max
Max
This topic is locked and no more replies can be posted.