This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
In one page the user can upload a image (in the html I use the element <input type="file" name="flUpload"....> and in the form I add this attribute: enctype="multipart/form-data"), when the user press Send I receive the form in a servlet. In this servlet I do this:
But when I upload my web site to my Tomcat 7 server, the user can't upload images. I have got this exception:
In my GlassFish server this runs OK, the user can upload images.
What can I do?
Joined: Jan 23, 2012
I solved the problem. I edit the file context.xml (tomcat->conf). You need to edit it, putting the attribute allowCasualMultipartParsing="true" in the tag <Context>, and then you have: <Context allowCasualMultipartParsing="true">. Restart the server and it works.
I am having the same issue.I applied the fix,but it doesn't works.I am using eclipse.Following is the Exception Report I am getting.....
Joined: Jan 13, 2013
Got it working.Although I am now able to upload the images into a directory on my file system but the image is not displayed on the jsp page,instead a default icon of broken image in displayed.Here is my complete code: