XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0 Alpha
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: PC

    • Bugzilla Id:
      22643

      Description

      You have published this code in the javadocs main page of the FileUpload and
      the last line of the code isn't right "fi.write("/www/uploads/" + fileName);"
      because the method write() doesn't accept Strings as parameters. Bye and thanks
      for the excelent library that you are sharing.

      public void doPost(HttpServletRequest req, HttpServletResponse res)

      { DiskFileUpload fu = new DiskFileUpload(); // maximum size before a FileUploadException will be thrown fu.setSizeMax(1000000); // maximum size that will be stored in memory fu.setSizeThreshold(4096); // the location for saving data that is larger than getSizeThreshold() fu.setRepositoryPath("/tmp"); List fileItems = fu.parseRequest(req); // assume we know there are two files. The first file is a small // text file, the second is unknown and is written to a file on // the server Iterator i = fileItems.iterator(); String comment = ((FileItem)i.next()).getString(); FileItem fi = (FileItem)i.next(); // filename on the client String fileName = fi.getName(); // save comment and filename to database ... // write the file fi.write("/www/uploads/" + fileName); }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pjlmas@yahoo.com Pablo
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: