plupload 플러그인에서 업로드 한 파일 이름이 null로 표시됩니다. 원본 파일 이름은 어떻게 얻을 수 있습니까? 제 실수는 어디 있는지 말해주세요.struts2 파일 이름 및 내용 유형 null, 업로드시 업로드
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(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
제가 지정된 인쇄 문에 따라 본체에 볼 수있다.
o_17oq47949abc11n51pg11rnah06a.jpg
E:\Documents and Settings\Pluto\My Documents\NetBeansProjects\ShareApp\build\web\
c:\temp\upload__408094b5_13e30976641__7fea_00000003.tmp
null
null
내 struts 구성에 문제가 있습니까? 나는 주석을 사용하고 있으므로 struts.xml 파일이 없다. 또는 파일 이름을 전송하는 plupload에 문제가 있습니다. 이름 매개 변수를 얻었을 때 실제 이름이 아닌 다른 이름 인 "o_17oq47949abc11n51pg11rnah06a.jpg"가 표시되기 때문입니다. 그렇다면 어떻게 원래 이름을 얻을 수 있습니까? 당신은 간단한 것을 작업을 수행하는 모든 플러그인을 사용하는 이유를 나는 아직도 이해가 안
감사와 관련
나는 간단하게 s : form 및 s : file을 사용할 수 있으며 여러 파일을 처리 할 수 있음을 알고 있습니다. 필요한 것은 아약스 업로드 및 단일 필드 업로드입니다. 만약 내가 struts 방식으로 여러 파일을 업로드하고 싶다면 복수 파일을 필요로합니다. 파일을 찾아보고 단일 파일 필드를 찾고 업로드 할 여러 파일을 찾고 있습니다. 희망이 무엇인지 알기를 바랍니다.Thankyou – Aadam
게다가 내가 생각하는 자체 파일 이름은 plupload에 의해 변경되고있다. 아직도 나는 잘 모르겠다. – Aadam
Struts2-jQuery 플러그인을 사용해 보셨습니까? http://stackoverflow.com/questions/5270288/upload-file-in-struts2-using-ajax 항상 s : 파일이 필요하지만, 단순히 jQuery를 사용하여 AJAX 호출을 perfomr로 업로드하면된다. 드래그 앤 드롭으로 업로드 할 때마다 다음과 같이 자바 스크립트를 작성해야합니다. http://html5doctor.com/drag-and-drop-to-server/ –