photo upload problom
Posted: Tue Sep 02, 2008 12:04 am
when user submit 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:
sure that the logo size is within limit and the folder permision is right. Any suggestion?
Just posting the code here if anyone see anything wrong with this code below.
help me
Code: Select all
Only png, gif, or jpg !!!Just posting the code here if anyone see anything wrong with this code below.
help me
Code: Select all
$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
}
}