4 Replies Latest reply on Feb 27, 2008 6:37 AM by rogerioaf

    Weird file upload problem - works in Firefox, not in IE

    konstandinos

      Hi I am using t:inputfileUpload to upload a file.

      The class is org.apache.myfaces.custom.fileupload.UploadedFile

      Instantiated object is myUploadedFile

      The file uploaded is moo.txt

      The file is uploaded from D:\files\

      The destination is /path/to/file/


      When I upload with Firefox, it writes it as /path/to/file/moo.txt

      When I upload with IE, it writes it as /path/to/file/D:\files\moo.txt

      I have System.out.println(myUploadedFile.getName()) in my controller.

      In Firefox, it prints "moo.txt"

      In IE, it prints "D:\files\moo.txt"

      Weird huh?

      Any ideas?

      (Side note: I cannot wait for richFaces built-in file upload).

        • 1. Re: Weird file upload problem - works in Firefox, not in IE
          konstandinos

          (pushing back to top)

          Any ideas?

          Thanks

          • 2. Re: Weird file upload problem - works in Firefox, not in IE
            konstandinos

            Hi guys

            This is the last time I shall push this post back to the top.

            I have yet to figure out a solution and am truly surprised that I'm the only one whose experienced this problem.

            Cheers,
            Konstandinos.

            • 3. Re: Weird file upload problem - works in Firefox, not in IE

              Sorry, I can't help you.

              First: Maybe it is the wrong forum for that question. Or is there any relation to a RF specific topic. Is it working outside of a RF environment as expected?

              Second: These days the RF team seems to be very busy. Normally they have more time for community questions - I think we have to be a little bit patient at the moment (there is a question of mine I post back to the top many time more then three and I'm still waiting...).

              • 4. Re: Weird file upload problem - works in Firefox, not in IE
                rogerioaf

                Try something like this
                create this function and pass the filename to it, i thing it will help u.... and please post only RF question on this forum, as requested.....


                public static String RemoveIEPath(String str_filename){
                if (str_filename.indexOf("\\")!= -1)
                {
                int slash = str_filename.lastIndexOf("\\");
                if (slash != -1)
                str_filename = str_filename.substring(slash + 1);
                // I think Windows doesn't like /'s either
                int slash2 = str_filename.lastIndexOf("/");
                if (slash2 != -1)
                str_filename = str_filename.substring(slash2 + 1);
                // In case the name is C:foo.txt
                int slash3 = str_filename.lastIndexOf(":");
                if (slash3 != -1)
                str_filename = str_filename.substring(slash3 + 1);
                }
                return str_filename.trim();
                }