Ive got a problem when i want to change image of guild:
This is part of php code
Whats wrong ? Or maybe i should find bug somewhere else?
The Following Errors Have Occurred:
- Sorry! Can't save your image.
This is part of php code
if($guild_leader)
{
$max_image_size_b = $config['site']['guild_image_size_kb'] * 1024;
$allowed_ext = array('image/gif', 'image/jpg', 'image/pjpeg', 'image/jpeg', 'image/bmp', 'image/png', 'image/x-png');
$ext_name = array('image/gif' => 'gif', 'image/jpg' => 'jpg', 'image/jpeg' => 'jpg', 'image/pjpeg' => 'jpg', 'image/bmp' => 'bmp', 'image/png' => 'png', 'image/x-png' => 'png');
$save_file_name = str_replace(' ', '_', strtolower($guild->getName()));
$save_path = 'guilds/'.$save_file_name;
if($_REQUEST['todo'] == 'save')
{
$file = $_FILES['newlogo'];
if(is_uploaded_file($file['tmp_name']))
{
if($file['size'] > $max_image_size_b)
$upload_errors[] = 'Uploaded image is too big. Size: <b>'.$file['size'].' bytes</b>, Max. size: <b>'.$max_image_size_b.' bytes</b>.';
$type = strtolower($file['type']);
if(!in_array($type, $allowed_ext))
$upload_errors[] = 'Your file type isn\' allowed. Allowed: <b>gif, jpg, bmp, png</b>. Your file type: <b>'.$type.'</b> If it\'s image contact with admin.';
}
else
$upload_errors[] = 'You didn\'t send file or file is too big. Limit: <b>'.$config['site']['guild_image_size_kb'].' KB</b>.';
if(empty($upload_errors))
{
$extension = $ext_name[$type];
if(!move_uploaded_file($file['tmp_name'], $save_path.'.'.$extension))
$upload_errors[] = 'Sorry! Can\'t save your image.';
Whats wrong ? Or maybe i should find bug somewhere else?