View Full Version : [PHP] struttura array $_FILES
Typhoon90
27-03-2010, 12:21
Salve a tutti, sono nuovo del PHP e mi sto cimentando con l'upload dei file. Mi trovo così a maneggiare l'array $_FILES, ma però non riesco a capire la struttura di questo, ho cercato sulla documentazione ufficiale e googlato un pò ed ho trovato solo user contributed notes poco chiare.
Chi può spiegarmi la struttura?
Grazie in anticipo
lupoxxx87
27-03-2010, 12:57
principalmente è un array che contiene array che contengono altre informazioni...
se fai print_r($_FILES) puoi vedere quanti files ci sono, mentre se fai print_r($FILES[..]) vedi le informazioni relative al determinato file
CozzaAmara
27-03-2010, 13:07
http://php.net/manual/en/reserved.variables.files.php
$_FILES è una variabile superglobale che incorpora N array annidati, es:
Array
(
[file1] => Array
(
[name] => MyFile.txt (comes from the browser, so treat as tainted)
[type] => text/plain (not sure where it gets this from - assume the browser, so treat as tainted)
[tmp_name] => /tmp/php/php1h4j1o (could be anywhere on your system, depending on your config settings, but the user has no control, so this isn't tainted)
[error] => UPLOAD_ERR_OK (= 0)
[size] => 123 (the size in bytes)
)
[file2] => Array
(
[name] => MyFile.jpg
[type] => image/jpeg
[tmp_name] => /tmp/php/php6hst32
[error] => UPLOAD_ERR_OK
[size] => 98174
)
)
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.