• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Required MultipartFile parameter 'file' is not present error

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team

I am new to this spring . hope to get solution for my issue as it is stopping my work for a day.
When i click the file upload button i have to display the progressing bar til the file is uploading. - this is my requirement

My problem is am able to upload a file without calling show progress bar function. but if i am using the showfunction am getting the " Required MultipartFile parameter 'additionalFile' is not present error in my console" though i have configured The Multipart resolver in xml.

So I am trying to write the fileUploader controller.


@RequestMapping(value = /uploadFile.action, method =
{ RequestMethod.POST })
@ResponseBody
public String save(@RequestParam(required = false, value = "file") final MultipartFile file,
@RequestParam(value = "nor", required = true) final String no, final ModelMap model)
{
final int no = Integer.parseInt(no);

try
{
if (!DataUtility.checkFileSize(file))
{
return "Error";
}
return some thing; }
catch (final Exception ex)
{
model.put("errorMsg", getMessageFromProperties(ex.getErrorCode(), null));
}
return null;
}

In JSP:


<div id="cdd" class="jjjt" style="display: none;">
<div class="popupTitle"><span><spring:message code="PLEASE_WAIT"/></span></div>

<div id="abc" style="padding-top: 10px;"></div>
<div style="padding-left: 40px;">
<div class="progressBar">
<div class="determinateProgress"></div>
</div>

</div>
</div>

<input type="file" name="file" id="file" class="fileInput" />

if (document.form.file.value != '') {
var dotPosition = document.form.file.value
.lastIndexOf('.');
var fileExtn = document.form.file.value.substring(
dotPosition,
document.form.file.value.length);
if (fileExtn == '.pdf' || fileExtn == '.doc') {
//document.body.style.cursor = 'wait';
showProgress('please wait');
$.ajaxFileUpload({
url : "uploadFile.action",
type : 'POST',
fileElementId : 'file',
cache : false,
data : {
no : no
},
dataType:"text",
success : function(response) {
closeProgress();

},
<script>
function showProgress(progressMsg) {
document.getElementById("abc").innerHTML = "";
document.getElementById("abc").innerHTML = progressMsg;
var dd= document.getElementById("cdd").innerHTML;
$(".jjj").colorbox({
html:dd,
'open':true,
width : "380px",
height : "200px",
maxWidth:"380px",
maxHeight:"600px"
});
document.getElementById("cboxClose").style.display = "none";
}

function closeProgress(){
$.fn.colorbox.close();
}


</script>

what am missing am not able to find it .

please help.

Thanks in advance
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is really hard to read. PleaseUseCodeTags <- click

Do you have this bean in your context.xml?


 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic