Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-13843

rich:fileUpload should use feature detection for File API

    Details

    • Workaround Description:
      Hide

      Use other browser; otherwise, none.

      Show
      Use other browser; otherwise, none.

      Description

      When using the RF4.5 rich:fileUpload component, browsers that do not support the HTML5 File API (e.g., IE9, which is P2 according to https://developer.jboss.org/wiki/PrioritizedRichFacesBrowsersCompatibilityMatrix), there is a JavaScript error that occurs:

      SCRIPT5007: Unable to get property 'match' of undefined or null reference
      File: fileupload.js, Line: 180, Column: 25

      If you examine the JavaScript in question, this exception is thrown by __addItem. This function tries to read the name property of the file argument passed in to it and assign it to the fileName variable. Because the argument is not the expected file object (and usually a string), fileName is assigned the undefined value. Two lines later, the code attempts to invoke the match function which fails for the obvious reason.

      Ideally, the file upload component would utilize some feature detection (checking for window.File and so on) or perhaps check that fileName is not undefined.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                thinkdev M S
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: