ot;text/html" %>
<%@ page import="javax.portlet.PortletURL" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects/>
<script type="text/javascript"
src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
+ "/dwr/interface/FileUploadProgressListener.js") %>'>
</script>
<script type="text/javascript"
src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
+ "/dwr/engine.js") %>'>
</script>
<script type="text/javascript"
src='<%= renderResponse.encodeURL(renderRequest.getContextPath()
+ "/dwr/util.js") %>'>
</script>
<script type="text/javascript">
function fileupload_ajax_query_upload_status() {
FileUploadProgressListener.getFileUploadStatus
(fileupload_ajax_show_upload_status);
return true;
}
function fileupload_ajax_show_upload_status(status) {
if (status == "100")
document.getElementById("fileupload_progress").innerHTML
="File successfully uploaded";
else {
document.getElementById("progressBar").style.display = "block";
document.getElementById("fileupload_progress").innerHTML=
"Uploading file: " + status
+ "% completed, please wait";
document.getElementById("progressBarBoxContent").style.width =
parseInt(status * 3.5) + "px";
setTimeout(fileupload_ajax_query_upload_status, 2000);
}
return true;
}
</script>
<style type="text/css">
#progressBar {padding-top: 5px; }
#progressBarBox {width: 350px; height: 20px; border: 1px insert; background: #eee; }
#progressBarBoxContent {width: 0; height: 20px; border-right: 1px solid #444;
background: #9ACB34; }
</style>
<h4>File Upload</h4>
<!-- the upload form -->
<% PortletURL pUrl = renderResponse.createActionURL();
%>
<form action="<%= pUrl.toString() %>"
enctype="multipart/form-data" method="post"
onsubmit="setTimeout('fileupload_ajax_query_upload_status()', 1000)">
<input type="file" name="fileupload_upload" value="Upload File">
<input type="submit" value="Upload">
</form>
<%-- file upload progress bar --%>
<div id="fileupload_progress"></