[Upload] Upload avec creation de directory: erreur d'array ?
Bonjour à tous !!
J'ai un code qui commence à me rendre fou ! Voici le script que j'utilise:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<div class="texte">
<table width="351" border="0">
<tr>
<td><div class="bloc_gauche"><img src="<? echo $URLAVATAR; ?>" alt=""/></div></td>
</tr>
</table>
<table><form name="formulaire_3" method="post" action="index.php?p=profil" enctype="multipart/form-data">
<input name="photo_1" type="file" class="content_box" id="photo_1" size="30" />
<input type="submit" name="submit" value="Continuer">
</form>
</table>
</div>
<?
// GESTION DE L'UPLOAD
$LOGIN = 'test' ;
if (isset($_FILES['photo_1'])) {
if(!is_dir("/$LOGIN")) mkdir ("/$LOGIN", 0755);
print_r($_FILES['photo_1']);
$ext = image_type_to_extension(exif_imagetype($_FILES['photo_1']['tmp_name']),true);
copy($_FILES['photo_1'], "/$LOGIN/photo_1.".$ext);
}
} |
Ceci me donne comme erreur:
Code:
1 2 3 4 5
| Array ( [name] => 3.jpg [type] => image/jpeg [tmp_name] => /Applications/MAMP/tmp/php/phplf6ELl [error] => 0 [size] => 59563 )
Notice: Array to string conversion in index.php on line 553
Warning: copy(Array) [function.copy]: failed to open stream: No such file or directory in
index.php on line 553 |
Le ligne 553 est:
Code:
copy($_FILES['photo_1'], "/$LOGIN/photo_1.".$ext);
Je ne comprends pas ce qui pose problème ! Voyez vous un problème ?
Merci @ tous !!
RedVivi