35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
$output = '<div style="text-align:center;">';
|
|
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 = 'tmp_'.$siren.'.'.$ext;
|
|
if( !move_uploaded_file($tmp_file, PATH_LOGOS . $name_file) ) {
|
|
$output.= '';
|
|
} else {
|
|
$output.= '<a id="logo_save" href="/?page=saisieajax&q=logo/save/'.$name_file.'">Sauvegarder l\'image</a>';
|
|
$output.= '<br/>';
|
|
$output.= '<a id="logo_crop" href="/?page=saisieajax&q=logo/crop/'.$name_file.'">Editer l\'image</a>';
|
|
}
|
|
} else {
|
|
$output.= '';
|
|
}
|
|
}
|
|
$output.= '</div>';
|
|
echo $output;
|
|
} |