aspose file tools*
The moose likes Spring and the fly likes file upload in spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "file upload in spring" Watch "file upload in spring" New topic
Author

file upload in spring

Ronwaldo Cruz
Ranch Hand

Joined: Oct 17, 2006
Posts: 69
Hi,

I need to know whether a file path is invalid during file upload using Spring form tag (In lower versions of IE, the path can be edited). I intended to do this using

<form method="post" action="upload.form" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit"/>
</form>

FileUploadBean bean= (FileUploadBean) aCommand;

if(bean.getFile == null)
{
//invalid path code
}

Curiously, a byte array instance is binded into the command class. Does anybody know why it is not null?

Thank you.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
What is the path from the command object, and what is your input?


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Ronwaldo Cruz
Ranch Hand

Joined: Oct 17, 2006
Posts: 69
Hi,

There is no input. I just press the button without choosing a file but within the Controller the Command Class still has a byte array instance binded into it
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: file upload in spring
 
Similar Threads
Upload attachment from JSP to Database?
Unable to upload file
File Upload using JSP
Uploading Excel spreadsheet into JSP
Spring MVC onSubmit not called