日期:2014-05-18  浏览次数:20627 次

jsp为什么收不到FLASH上传的文件
用FLASH的FileReference类进行文件选择连到jsp进行上传保存,但是文件老不能保存,flash也不报什么错。
jsp用了jspsmart上传,从HTML传过来的FILE可以保存,但用flash就不能保存了,请各位高手指点一下啊。

JSP代码
<%@   page   import= "com.jspsmart.upload.* "%>
<%@       page       import= "java.io.* "   %>  
<jsp:useBean   id= "mySmartUpload "   scope= "page "   class= "com.jspsmart.upload.SmartUpload "   />
<%
java.lang.String       strFolderName,serverPath,strFolderPath;      
java.io.File       objFolder;      
int       intLength,num;      
String   ext= "gif,jpg,jpeg,bmp,png,JPG,GIF,BMP,PNG ";
String   paths= "/upload/ ";
int   max_size=500000;
mySmartUpload.setDenyPhysicalPath(true);
int   count=0;
mySmartUpload.initialize(pageContext);
mySmartUpload.setAllowedFilesList(ext);
mySmartUpload.setMaxFileSize(max_size);
mySmartUpload.upload();
com.jspsmart.upload.File   myFile   =   mySmartUpload.getFiles().getFile(0);                    
myFile.saveAs(paths   +   myFile.getFileName(),   mySmartUpload.SAVE_VIRTUAL);
%>


FLASH代码
Stage.showMenu   =   false;

import   flash.net.FileReference;

var   fileRef:FileReference   =   new   FileReference();

var   fileLsn:Object   =   new   Object();

var   fileTyp:Array   =   new   Array({description: "Image   files ",   extension: "*.jpg;*.gif "},   {description: "Document   files ",   extension: "*.txt;*.doc "});
btnBrowse.onRelease   =   function()
{
                fileRef.browse(fileTyp);
};
btnUpload.onRelease   =   function()
{
       
        fileRef.upload( "http://localhost:8080/up/upload.jsp ");         //传到的jsp页面,也就是上面的jsp代码
};
btnClear.onRelease   =   function()
{
        strState.text   =   " ";
};

fileLsn.onSelect   =   function(file:FileReference)
{
        strState.text   +=   "onSelect   ' "+file.name+ " '\n ";
};

fileLsn.onCancel   =   function(file:FileReference)
{
        strState.text   +=   "Cancel!\n ";
};

fileLsn.onOpen   =   function(file:FileReference)
{
        strState.text   +=   "Uploading...   ' "+file.name+ " '\n ";
};

fileLsn.onComplete   =   function(file:FileReference)
{
        strState.text   +=   "File   ' "+file.name+ " '   upload   successfull!\n ";
};

fileLsn.onProgress   =   function(file:FileReference,   bytesLoaded:Number,   bytesTotal:Number):Void  
{
        strState.text   +=   "onProgress:   "+file.name+ "   with   bytesLoaded:   "+bytesLoaded+ "   bytesTotal:   "