1

I am having trouble uploading an image with JSP in Tomcat. I had some old code, but the packages seem to be deprecated now or whatever.

Is there some tutorial for that.

George Kastrinis
  • 4,924
  • 4
  • 29
  • 46
  • Have you [searched for answers before](http://stackoverflow.com/search?q=[java]+file+upload+servlet+jsp)? Now would be a good time to go through those links. This has been whipped to death on the java and servlet tags. – Vineet Reynolds Jun 23 '11 at 15:20
  • http://www.roseindia.net/jsp/upload-insert-csv.shtml – Srikanth Venkatesh Jun 23 '11 at 15:20
  • Yes, there probably is a tutorial for that. – Marcelo Jun 23 '11 at 15:21
  • I have searched. I just can't make them work. For example import org.apache.commons.fileupload gives that package does not exists. I have netbeans 7 and tomcat 7. – George Kastrinis Jun 23 '11 at 16:12
  • possible duplicate of [How to upload files in JSP/Servlet?](http://stackoverflow.com/questions/2422468/how-to-upload-files-in-jsp-servlet) – BalusC Jun 25 '11 at 06:28
  • @Srikanth: http://stackoverflow.com/questions/5038798/uploading-of-pdf-file/5041420#5041420 – BalusC Jun 25 '11 at 07:53

1 Answers1

1

If you want to do it with FileUpload in Apache Common... There user guide is a good place to start. http://commons.apache.org/fileupload/using.html

But there is an easy way to upload files to the server side. You can download the code from here. http://dl.dropbox.com/u/22048850/com.rar

try {
           com.tutetree.upload.manager.UploadManager up  = new com.tutetree.upload.manager.UploadManager(request);
           out.print(new String(up.getDataBytes()));
        } catch (Exception e) {
        }

But if you want additional functions the best option is to use the FileUpload in Apache Common

Hope this helps ^^

Chan
  • 2,601
  • 6
  • 28
  • 45