I am getting file name in action as null, uploaded from plupload plugin. how can i get the original file name. Please tell where is my mistake.
jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
<head>
<title>test</title>
<sj:head compressed="false"/>
<link rel="stylesheet" type="text/css" href="plup/jquery.plupload.queue/css/jquery.plupload.queue.css" type="text/css" media="screen" />
<script type="text/javascript" src="plup/plupload.full.min.js"></script>
<script type="text/javascript" src="plup/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script type="text/javascript">
/* Convert divs to queue widgets when the DOM is ready */
$(function(){
function plupload(){
$("#uploader").pluploadQueue({
// General settings
runtimes : 'html5,gears,browserplus,silverlight,flash,html4',
url : 'uploads',
max_file_size : '10mb',
unique_names : true,
chunk_size: '2mb',
// Specify what files to browse for
filters : [
{title: "Image files", extensions: "jpg,gif,png"},
{title: "Zip files", extensions: "zip"}
],
resize: {width: 320, height: 240, quality: 90},
// Flash settings
flash_swf_url : 'plup/Moxie.swf',
// Silverlight settings
silverlight_xap_url : 'plup/Moxie.xap',
multipart_params: {'user': 'admin', 'time': '2012-06-12'}
});
}
plupload();
$('#clear').click(function(){
plupload();
});
});
</script>
</head>
<body>
<div>
<div style="width: 750px; margin: 0px auto">
<form id="formId" action="submit.action" method="post">
<div id="uploader">
<p>Flash, Silverlight, Gears, BrowserPlus,HTML5 .</p>
</div>
<input type="button" value="Clear" id="clear"/>
</form>
</div>
</div>
</body>
</html>
Action
@Action(value="plupUploaduploads")
public String upload() throws Exception {
isMultipart = ServletFileUpload.isMultipartContent(getReq());
System.out.println(getReq().getParameter("value"));
ServletContext servletContext = getReq().getServletContext();
String filePath = servletContext.getRealPath("/");
System.out.println(filePath);
System.out.println(this.file);
System.out.println(this.fileName);
System.out.println(this.contentType);
File theFile = new File("c:\\",this.getFileName());
FileUtils.copyFile(file,theFile);
return SUCCESS;
}
//getters and setters
i can see this on console according to print statements given.
o_17oq47949abc11n51pg11rnah06a.jpg
E:\Documents and Settings\Pluto\My Documents\NetBeansProjects\ShareApp\build\web\
c:\temp\upload__408094b5_13e30976641__7fea_00000003.tmp
null
null
is it the problem in my struts config? I am using annotations hence dont have struts.xml file. Or the problem is in plupload sending the file name, because when i retrived the name parameter i am getting some different name "o_17oq47949abc11n51pg11rnah06a.jpg" which is not the actual name. If so how can i get the original name?
Thanks and regards