选择上传文件的:
jsp页面代码:
up.mxml代码:
jsp页面代码:
引用:
<%@ page contentType="text/html; charset=gb2312"%>
<%@ taglib uri="FlexTagLib" prefix="mm" %>
<html>
<script language="javascript">
function browse()
{
var file = document.TestFile.MyFile;
file.click();
var filevalue = file.value;
window.document.FlexApp.SetVariable("setvalue", filevalue);
}
</script>
<body scroll="no">
<div style="display:none">
<form action="servlet/FileUploadServlet" method="post" enctype="multipart/form-data" name="TestFile">
<input name="MyFile" type="file">
</form>
</div>
<mm:mxml name="FlexApp" source="up.mxml" />
</body>
</html>
up.mxml代码:
引用:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
<mx:Script>
function set setvalue(path:String) {
reviewer.text=path;
}
</mx:Script>
<mx:HBox>
<mx:Label text="上传文件:"/>
<mx:TextInput id="reviewer" width="200"/>
<mx:Button label="浏览" click="getURL(javascript:browse())"/>
</mx:HBox>
</mx:Application>
回复Comments
作者:
{commentrecontent}