';
if ( !empty($siren) && isset($_FILES['file']) &&
$_FILES['file']['error']!=UPLOAD_ERR_NO_FILE ) {
$logoFile = $_FILES['file'];
$tmp_file = $logoFile['tmp_name'];
if ( $logoFile['error']!=UPLOAD_ERR_OK ) {
$output.= '';
} elseif ( !is_uploaded_file($tmp_file) ){
$output.= '';
} else {
// On vérifie maintenant l'extension
$extAuthorized = array('jpeg', 'jpg', 'png', 'gif', 'bmp');
$type_file = str_replace('image/', '',$logoFile['type']);
$ext = '';
if ( in_array($type_file, $extAuthorized) ){
$ext = $type_file;
}
if ( !empty($ext) ){
// on copie le fichier dans le dossier de destination
$name_file = $siren.'.'.$ext;
if ( file_exists(PATH_LOGOS . $name_file) ){
unlink(PATH_LOGOS . $name_file);
}
if( !move_uploaded_file($tmp_file, PATH_LOGOS . $name_file) ) {
$output.= '';
} else {
$output.= '';
$output.= '
';
$output.= 'Editer l\'image';
}
} else {
$output.= '';
}
}
$output.= '';
echo $output;
}
exit;
}
?>