Probleme d'upload d'image
Bonjour à tous,
Voila je doit faire un upload d'image (AS3 + PHP) mais j'ai un soucis et je ne vois pas ce qui cloche...
Code AS3
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 32
|
package classes {
import flash.events.Event;
import flash.net.FileReference;
import flash.net.URLRequest;
public class MaClasse{
[Bindable]
private var _fileReference:FileReference = new FileReference();
[Bindable]
private var _request:URLRequest = new URLRequest("http://localhost/xxxx/upload.php");
public function ouvrirBoite():void {
_fileReference.browse();
_fileReference.addEventListener(Event.SELECT, select);
}
private function select(pEvent:Event):void {
_fileReference.upload(_request,"fichier");
}
}
} |
Code PHP de mon fichier upload.php se situant bien "http://localhost/xxxx/"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
$nom_img = "NomImage";
if ($_FILES['fichier']['type'] == 'image/jpeg') { $extention = '.jpeg'; }
if ($_FILES['fichier']['type'] == 'image/jpg') { $extention = '.jpg'; }
if ($_FILES['fichier']['type'] == 'image/pjpeg') { $extention = '.jpeg'; }
if ($_FILES['fichier']['type'] == 'image/pjpg') { $extention = '.jpg'; }
if ($_FILES['fichier']['type'] == 'image/png') { $extention = '.png'; }
if ($_FILES['fichier']['type'] == 'image/gif') { $extention = '.gif'; }
$img = $nom_img.$extention;
move_uploaded_file($_FILES['fichier']['tmp_name'], "http://localhost/xxxx/".$img); |
J'arrive à acceder au "browse" mais apres je ne vois pas ce qui ce passe.
Merci d'avance :)