/ Flex代码 /
private const UPLOAD_URL:String = "http://myhosting/upload/upload.php";
private var cer:FileFilter = new FileFilter("Archivos Cer", "*.cer");
private var key:FileFilter = new FileFilter("Archivos Key", "*.key");
private var fileref:FileReference = new FileReference();
private var fileref2:FileReference = new FileReference();
protected function button_clickHandler(event:MouseEvent):void
{
var request:URLRequest = new URLRequest();
request.method = URLRequestMethod.GET;
request.url = UPLOAD_URL;
fileref.upload(request);
fileref2.upload(request);
}
嗯,这是我用来将文件上传到服务器的过程。我服务器中的“upload.php”是:
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
有没有办法在FLEX中执行此操作?
答案 0 :(得分:1)
你的意思是,没有PHP或其他服务器端代码?不,你不能。您需要服务器上的一些代码才能接受上传的文件。