PDA

Zobacz pełną wersję : Kunena - nie można wgrać własnych avatarów



a-l-i-c-j-a
15-08-2010, 19:02
Przy próbie wczytania własnego avatara z dysku lokalnego pojawia się komunikat:

JFile::copy: Cannot find or read file:
JFile::copy: Cannot find or read file:
JFile::copy: Cannot find or read file:

---------- Post dodany o 17:02 ---------- Poprzedni post był o 17:00 ----------

Rozwiązanie:

edytujemy plik: /components/com_kunena/lib/kunena.file.class.php

odnajdujemy fragment kodu:

function tmpdir()
{
static $tmpdir=false;
if (!empty($tmpdir)) return $tmpdir;

if (function_exists('sys_get_temp_dir')) {
$tmpdir = sys_get_temp_dir();
} else {
$file = tempnam(false,false);
if ($file === false) return false;
unlink($file);
$tmpdir = realpath(dirname($file));
}
return $tmpdir;
}

i zastępujemy:


function tmpdir()
{
static $tmpdir = false;
if (!empty($tmpdir)) return $tmpdir;

//Try php >= 5.2.1 functionality
if (function_exists('sys_get_temp_dir')) {
$tmpdir = sys_get_temp_dir();
$file = tempnam($tmpdir, false);
if ($file !== false)
{
unlink($file);
return $tmpdir;
}
}

//Try php setting
$tmpdir = ini_get('upload_tmp_dir');
$file = tempnam($tmpdir, false);
if ($file !== false)
{
unlink($file);
return $tmpdir;
}

//Last resort, try system tmp dir
$file = tempnam(false, false);
if ($file !== false)
{
unlink($file);
$tmpdir = realpath(dirname($file));
return $tmpdir;
}

return false;
}

źródło: http://www.kunena.com/forum/139-k-15-support-archive/22224-avatar-upload-doesnt-work?limit=10&start=10