5 Replies Latest reply on May 10, 2013 12:38 PM by Michael Ferrante-Oracle

    client_get_file_name directory name not working

    Michael Tsilikidis
      Hello all,

      when calling client_get_file_name (or any other function tha opens the dialog) to open a file dialog forms is ignoring the directory_name parameter I pass and always opens user's My Documents.

      I searched the forum and found that people had the same issue but all of them used Forms version 10. In some of the answers the solution was to install a patch as the cause was actually a bug. Since I'm using a newest version of Forms I'm creating this thread.

      I'm using Form Builder
      Database 11g.
      Java Runtime versions installed and enabled on the machine running the form: 1.6.0_20 and 1.7.0_21

      Thanks in advance.
        • 1. Re: client_get_file_name directory name not working
          Michael Ferrante-Oracle
          Just for clarification, you said " +I'm using a newest version of Forms+". This may be the newest major version, however the latest patched version is, which would include updates for WebUtil if any existed.

          As for your issue, because you didn't provide details regarding exactly what you are doing or how you are doing it, I will guess. There is a known issue (bug 10015816) which causes the opening directory to be one lower than what you set as the default. There is a work-around, but it appears to only work with FILE_OPEN_DIALOG. This does the same thing as CLIENT_GET_FILE_NAME so changing should be too much of an issue. The trick to making it work is to add a trailing slash to the end of the directory. For example:

          WEBUTIL_FILE.FILE_OPEN_DIALOG ('C:\tmp\hello\ ' ...
          • 2. Re: client_get_file_name directory name not working
            Michael Tsilikidis
            Thank you for trying to help.

            Allow me to correct the "newest". I wanted to write that I'm using a "newer" form builder version.

            Therefore simply thinking I assumed that patches regarding the 10th version of forms are included in the 11th version.

            Indeed I didn't provide much detail or code example but it seems you didn't read well, I said it always opens user's My Documents regardless what I set as a directory_name. So, it doesn't seem to be the bug you are mentioning.

            Here is how I use this function:

            l_filename varchar2(200);

            l_filename := client_get_file_name(directory_name => 'C:\',
            file_name => null,
            file_filter => 'All Files (*.*) |*.*|pdf Files (*.pdf)|*.pdf|JPEG Files (*.jpg)|*.jpg|',
            message => 'Choose a file',
            dialog_type => null,
            select_file => null);
            • 3. Re: client_get_file_name directory name not working
              Michael Ferrante-Oracle
              I have done a little more investigating and think I am closer to identifying the root cause of the problem. In the mean time, it appears that you can correct the issue in your plsql simply by adding a blank space after the path, but within the quotes. For example change your code as follows:
              l_filename := client_get_file_name(directory_name => 'C:\ ',
              Notice the space added after C:\

              If your path included a sub-directory you would need to ensure that it included a trailing \ and the blank space. For example:
              l_filename := client_get_file_name(directory_name => 'C:\temp\ ',

              Edited by: Michael Ferrante (Oracle) on May 9, 2013 10:29 AM
              1 person found this helpful
              • 4. Re: client_get_file_name directory name not working
                Michael Tsilikidis
                Indeed the blank space after the path did the trick. It solved the issue partially though.

                The question now is, how do we deal with the case passing NULL to the directory_name parameter? I'm not sure but I think I've read somewhere in the documentation that leaving this parameter NULL gives it the functionality to always hold the last directory opened. So the trick with the blank space doesn't seem to work in this case.
                • 5. Re: client_get_file_name directory name not working
                  Michael Ferrante-Oracle
                  The exact behavior for passing in NULL likely will vary depending on the client OS and the JRE version being used. That said, my opinion is that I would not code the app in such a way to allow the user to not pass a value. If NULL is entered you should either throw a custom error indicating that some path must be enter or hard code your own default location. The user home directory is always a good place to land when nothing is passed in. Expecting to retain the value of the last opened directory is not practical in Forms unless you code that yourself.
                  1 person found this helpful