Topic
4 replies Latest Post - ‏2013-01-22T04:23:05Z by kevintap
Sri.
Sri.
79 Posts
ACCEPTED ANSWER

Pinned topic Not able to delete uploaded files

‏2013-01-16T08:50:06Z |
Hi,

I am using File Upload builder to upload an MS Excel file and I'm able to get the file content using Spreadsheet Import builder (builderName.getContent() after setting builderName.setFileToImport()) and then save it to a variable. Now I want to delete the uploaded Excel file. java.io.File.delete() is not working. I am able to verify File.exists(), File.canRead(), File.canWrite() etc. I think the Spreadsheet Import builder has opened the file to get contents and the file is not closed properly. Any idea how do I fix this? Thanks.
Updated on 2013-01-22T04:23:05Z at 2013-01-22T04:23:05Z by kevintap
  • mburati
    mburati
    2392 Posts
    ACCEPTED ANSWER

    Re: Not able to delete uploaded files

    ‏2013-01-18T15:34:14Z  in response to Sri.
    I haven't heard of this particular problem myself.

    What version of WEF (including fixpack level) are you using?

    ..Mike Burati
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    • mburati
      mburati
      2392 Posts
      ACCEPTED ANSWER

      Re: Not able to delete uploaded files

      ‏2013-01-18T15:46:35Z  in response to mburati
      Also, in addition to the version/fixpack info, if you could verify whether you also have problems deleting the file if you do NOT import the spreadsheet after upload (eg, just upload, verify it exists and then attempt to delete it) that would narrow down whether it's something the spreadsheet import is doing, or the file upload not closing it properly or possibly some other security restriction preventing deletion of the file in your environment. You could also try hand copying a file into that location in the WAR and verifying that the same webapp can delete that file.

      I hope that info helps,
      ..Mike Burati
      http://www-10.lotus.com/ldd/pfwiki.nsf/
      The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
      • Sri.
        Sri.
        79 Posts
        ACCEPTED ANSWER

        Re: Not able to delete uploaded files

        ‏2013-01-19T07:08:14Z  in response to mburati
        WEF Version - 7.0.1.4
        Build id: 201206140712

        Yes, I am able to delete the file if I don't call the method <SpreadsheetImportBuilderName>.getContent(). Problem is only if I import the file content using Spreadsheet Import builder.
        • kevintap
          kevintap
          712 Posts
          ACCEPTED ANSWER

          Re: Not able to delete uploaded files

          ‏2013-01-22T04:23:05Z  in response to Sri.
          Looking at the code involved here, it looks like there may be cases where an InputStream for the specified file is opened by the Spreadsheet Import builder, but not closed. I would suggest opening a PMR with IBM support if you require a fix for this behavior.

          The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.