Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
5 replies Latest Post - ‏2013-01-31T20:08:41Z by mburati
SystemAdmin
SystemAdmin
9029 Posts
ACCEPTED ANSWER

Pinned topic How to restrict specific file format with File upload builder.

‏2013-01-29T04:36:44Z |
Hi,

I am using WPF 7.0. In my model I have used the File Upload builder. I need to restrict the some of file format with that File upload builder. I do not want upload those file which list provided by user.
For this purpose I did the validation on front end. It's working good. As per user view file did not get uploaded. But in actual File is uploaded at server end. So need to restrict those file. Those will get uploaded at server end It's my requirement.

Thanks in advance.
Updated on 2013-01-31T20:08:41Z at 2013-01-31T20:08:41Z by mburati
  • mburati
    mburati
    2552 Posts
    ACCEPTED ANSWER

    Re: How to restrict specific file format with File upload builder.

    ‏2013-01-29T15:36:12Z  in response to SystemAdmin
    Verifying as much as you can in JS on the client/browser is a good thing, to reduce accidental uploads of incorrect files.

    For security reasons, like data validation, you should definitely validate inputs on the server, in case someone bypasses the Javascript based validation.

    Just as a banking app (built with any tool) should validate banking data inputs (eg, a debit value should not be negative or greater than the current account balance) before executing a debit operation, you should validate your file upload data to your app's criteria before doing anything with it.

    The upload folder in the WAR is meant to be a "temporary" location for file uploads, where your app validates the files uploaded and determines whether they're valid to keep and then where to move them if they're acceptable to the application. You definitely don't want to keep them in the temporary location, as the WAR contents will get replaced if you redeploy the WAR with updates.

    If you search for "File Upload" in the forum search box above, you'll find numerous threads with tips/suggestions for using the file upload builder and support with WEF.

    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.
    • SystemAdmin
      SystemAdmin
      9029 Posts
      ACCEPTED ANSWER

      Re: How to restrict specific file format with File upload builder.

      ‏2013-01-31T04:36:44Z  in response to mburati
      Hi Please provide me the link. I have already tried to search on forum. But I am unable to find the solution.
      • mburati
        mburati
        2552 Posts
        ACCEPTED ANSWER

        Re: How to restrict specific file format with File upload builder.

        ‏2013-01-31T15:29:25Z  in response to SystemAdmin
        I'm not sure what you mean by "the link". If you search for File Upload in the forum above, you will find other previous threads recommending that you should check the uploaded file and then move them somewhere more permanent. There's no link to something that does it for you, your application action that is called on the upload should call Java LJO/Method code that you write that checks whatever you want to check about the file and then moves it (in the filesystem or to a DB) to a more permanent place.

        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.
        • SystemAdmin
          SystemAdmin
          9029 Posts
          ACCEPTED ANSWER

          Re: How to restrict specific file format with File upload builder.

          ‏2013-01-31T16:09:50Z  in response to mburati
          Actually, I meant by "The link" is forum thread. I have already implemented the File format validation and file move implementation. But the thing is that on screen It's shows the message that please select write file format which is defined by client. But in actual file get uploaded at server side. This is the problem.
          • mburati
            mburati
            2552 Posts
            ACCEPTED ANSWER

            Re: How to restrict specific file format with File upload builder.

            ‏2013-01-31T20:08:41Z  in response to SystemAdmin
            If you've implemented your own app specific file format validation and move implementation, then I would think you would want to have that code remove the file if it does not meet your application's criteria for an acceptable uploaded file, before returning an error to the user.

            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.