Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File Upload...strange  RSS feed

Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I am having problems uploading pdf files on the server. I have attached a file that works fine. it allows me to upload .swf, .jpg, .gif, .mov, .mp3, .txt, .zip and various other but not .pdf. And the amazing thing is that it happens on windows platform (Server Platform). The same code works fine on linux. I can open uploaded .pdf files without any error (uploaded using tomcat-linux). However I get error while opening uploaded .pdf files (uploaded using JRUN OR Tomcat -- Windows).
Can some one please tell me what is going on? I do not understand what is wrong with this code. Can someone please help me understand what is wrong and how to fix this?

On line 4 change the value to the path where you wish to upload pdf files:
String savePath="/etc/jakarta-tomcat-4.1.12/webapps/";
1. Rename the attachment to .jsp
2. For the time being I have hard coded the file name to test23.pdf so please delete this file before you use this upload file code second time.

Just run the attachment (After renaming and using http://local.....) to test experience yourself. It will display 2 fields:
1. Type in anything in the first field and then point to a pdf file using the browse... button.

Code for JSP can either be downloaded from:
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!