7 Replies Latest reply on Oct 27, 2006 2:08 PM by Newsgroup_User

    Streaming files to the internet browsers

    TangoRules
      Someone told me that in ASP, you can create a file stream and specify the data type and then the internet browsers would display this file on the screen. From the users' point of view, they see the entire file on the screen. Is there a way to do the same thing in ColdFusion?
        • 1. Re: Streaming files to the internet browsers
          Level 7
          Probably, but I'm not clear on what are you trying to do?

          Stream some kind of content to the browser?

          Deliver other types of files such as .doc or .crw?
          • 2. Re: Streaming files to the internet browsers
            TangoRules Level 1
            I have an application that would allow users to update files to a file server and then users would be able to view these files online. The file server and the internet servers are two physically different servers. There are restrictions on who can and cannot view these files.

            I have created a user name that the ColdFusion service is going to use to access the file server. When I list out the files on file server, I am actually specifying the paths to the actual file server. The problem I have is, for those people who don't have already have access to the file server, they cannot view the files. One way I can think of to solve this problem is to use ColdFusion to copy the file over from to a temp folder under web root on the Internet server. And then people would be viewing the copy on the internet server. But if I were to do it this way, I would also need to create some kind of clean up the process to delete these files in the temp folder.

            In the process of discussing with my supervisor and some other guys, someone told me that ASP can create a file stream and all that he had to do is to specify the file type and the users would be able to view the files. This way would probably be better because I wouldn't need to store the files on the internet server; hence, I don't need to create any clean up process.

            FYI, the files that are being uploaded can be of any types, .doc, .xls, .pdf, ...etc.

            Thanks in advance,
            Monte
            • 3. Re: Streaming files to the internet browsers
              James74 Level 1
              I'm a little confused, if you've created a Coldfusion user, shouldn't anyone that has access/permissions on the CF Website be
              able to access files through the coldfusion user? It should just be a path that CF uses to locate a file right?
              • 4. Re: Streaming files to the internet browsers
                Level 7
                In the process of discussing with my supervisor and some other guys,
                someone told me that ASP can create a file stream and all that he had
                to do is to specify the file type and the users would be able to view
                the files. This way would probably be better because I wouldn't need to
                store the files on the internet server; hence, I don't need to create
                any clean up process.

                FYI, the files that are being uploaded can be of any types, .doc,
                .xls, .pdf, ...etc.


                AHHH, I think I understand your requirement better. I believe what you
                want to do is use the <cfcontent ...> tag. It can be used to serve any
                file accessible by the CF service to the client. You will probably want
                to combine it with a <cfheader...> tag or two, to control the
                mime-type/extension and|or name of the delivered file, otherwise CF
                defaults to the name of the template used to serve the content.


                • 5. Re: Streaming files to the internet browsers
                  TangoRules Level 1
                  well, when doing uploading files, it is ColdFusion that is doing the upload using CFFile. But when it is listing the files out, I am using the UNC paths to the files. When users click on the hyper links, they are hitting the UNC paths directly and so, this ColdFusion user is not user access the file anymore.

                  The reason why I cannot just upload the files to the Internet servers is because I am doing load balancing. I would need to upload the files to all of the Internet servers. That's why I decided to have a centralized place to house all the documents.
                  • 6. Re: Streaming files to the internet browsers
                    TangoRules Level 1
                    I have tried using CFContent but I have to specify a type. Oh by the way, I am still using ColdFusion 5 (Yes, I know it is an old version and I don't think my employer would want to upgrade it because my employer is moving away from ColdFusion. I am pretty much the only ColdFusion guy here. Well, but this is a different story).

                    When I use CFContent, what file type should I use though? Based on the livedocs, it only lists out five different file types and none of them has anything to do with PDF file. Should I specify that PDF file type in CFHeader tag or CFContent tag?
                    • 7. Re: Streaming files to the internet browsers
                      Level 7
                      When I use CFContent, what file type should I use though? Based on the
                      livedocs, it only lists out five different file types and none of them
                      has anything to do with PDF file. Should I specify that PDF file type
                      in CFHeader tag or CFContent tag?


                      Well you can but try and see what happens. Unfortunately CFContent is
                      one of the tags that has been improved in newer versions of CF. Being
                      restricted to a six year old product does such. Maybe you can feel good
                      at all the things ASP.NET could not do in 2000, since it did not exist
                      then. Then again maybe not!