在RiaCn求助,没想到被加精华贴了:)

      无聊CoDeR'S无聊话 2004-9-27 12:37
选择上传文件的:
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>



标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}