Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in image File format

kalai rathi
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Spring MVC

I am uploading image into DataBase. Before uploading the image,validate the image file format .
The file format should be (*.png,*.jpeg,*.jpg,*.gif) ,for other types must show error. this is the logic.

this is my jsp
<form:form commandName="event" id="eventForm" name="eventForm" method="post" enctype="multipart/form-data">

<label>Event Photo</label>
<input type="file" name="eventPhoto"/>
<form:errors path="eventPhoto" cssClass="error" />

My validation here.

errors.rejectValue("eventPhoto", "filetype.required");

the above code has worked in Safari, Firefox, Chrome. Except IE

when i upload *.bmp image in IE it accepts as --- image/pjpeg

it doesn't show error. IE accepts all image formats. This is the problem.

problem 2)

validate the image dimension ( height & weight) like 400*400

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic