File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "file upload in spring" Watch "file upload in spring" New topic

file upload in spring

Ronwaldo Cruz
Ranch Hand

Joined: Oct 17, 2006
Posts: 69

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"/>

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

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
I agree. Here's the link:
subject: file upload in spring