7 Replies Latest reply on Feb 24, 2011 9:29 AM by Pablo Souza

    FileNaming in flex

    bspShankar Level 1

      Hi,

       

      In my application the user is allowed to save a file, by giving his own name.  But file name is not mandatory, when the user does not give file name i am giving the file name has Untitled.extension, the problem is how to check whether the file name already exists within a folder, if it exists how to name the file i.e from Untitled.html to Untitled1.html or untitled2.html and so on........

       

      How can  the file name be given from user end ...

       

      Pls give me an hint.....

       

      Thanks & Regards

        • 1. Re: FileNaming in flex
          Pablo Souza Level 3

          Hi,

           

          Are you using the flash.net.FileReference class, right?

          If so, you can just call  the save() method and If there is another file with the same name, Flash Player is gonna ask the user for overwrite current file or choose another filename.

           

          Regards,

          Pablo Souza

          • 2. Re: FileNaming in flex
            bspShankar Level 1

            Hi,

            No i am not using FileReference,i am storing in the below mwntioned manner, in local file system

             

            var file:File = File.applicationStorageDirectory.resolvePath("C:\\My Library\\"+ filename);

             


            How can  i solve this......

             

            Pls let me know under what circumstances should we store data in local system.....suppose if client system crashes the complete data goes away.....

             

            Storing the client related data at server side is most feasible so that it can be recovered at any point....pls let me know or suggest me if i am wrong...

             

            Storing 1000's of large amount of client data on server is also a burden on server...... retriving will take time??????

             

            All client related data are .html files.....But the user is not given the option to choose his own location to store the files...so iam confused....

             

            Guide me pls

             

            Thanks & Regards

            • 3. Re: FileNaming in flex
              Pablo Souza Level 3

              Ok, it's a AIR app.

              The File class extends FileReference and adds some features that aren't allowed in a SWF running in a browser, due to security concerns.

               

              Can you explain me what this application does? This way we can evaluate the best moment to store data in the client and when it's better store this data in the server side.

               

               

              Regards,

              Pablo Souza

              • 4. Re: FileNaming in flex
                bspShankar Level 1

                Hi,,

                 

                Yes i will..

                 

                The application i am working is a desktop Air application, we are developing a product where there are millions of files stored in server.

                 

                On search of particular file or click of dropdown the datagrid populates with result...

                 

                on click of particular file name the file opensup in html component.

                 

                if the user wishes to save the file for further reference such has his notes......we will allow him to store...file location will not be known to user....

                 

                He just allowed  to specify two fields i.e 1. filename 2. folder name

                 

                I.e He can access those stored files only from  product but not outside....so he will not be knowing the location....

                 

                Files will be stored has hidden...

                 

                I thought of storing all the client realted files in server...but it would be  burden for accessing

                 

                if we store the samein client local system ...if suppose client system crashes the data is lost and no more recovered, which is disadvantage

                 


                How to overcome this factor....

                 

                If it was a web application every thing on server would be mandatory..

                 

                But since this is Air desktop application....i am confused

                 

                 

                Thanks & regards

                • 5. Re: FileNaming in flex
                  Pablo Souza Level 3

                  There are points that are still unclear for me.

                   

                  The user can see the retrieved file into a HTML component, but can the user edit the file?

                  If so, then I believe it's a good thing update the file into the server and don't store it locally.

                   

                  Another point, if you store it locally others application's users will not be able to see it through other machine. You must evaluate if you have this need.

                   

                  And there is the fact mentioned before, if the client's machine crashes you will loose all files saved locally.

                  If it has a big impact for application's usage, you must consider save all files in the server.

                   

                  And take a look at the documentation, it may helps: http://livedocs.adobe.com/flex/3/html/help.html?content=Filesystem_03.html

                   

                   

                  Regards,

                  Pablo Souza

                  • 6. Re: FileNaming in flex
                    bspShankar Level 1

                    Actually the files stored from a particular client after any updation if needed, is unique to only that particular user but not for all the other users .......

                     

                    It is now the property of only that particular client who makes changes.....

                     

                    if he wants to view it again, he can view any time with in our product only...

                     

                    The files stored from one client is not accessible to other......

                     

                    The original document in server will not be changed in any way....

                     

                     

                    it is with  respect to unique user only.......

                     

                     

                    Thanks & Regards

                    • 7. Re: FileNaming in flex
                      Pablo Souza Level 3

                      You must just evaluate if these updated files are really important for the system usage.

                      If it's that important, then consider saving it in the server. If not, then go ahead and save it in locally.

                       

                      You can get all important information about the File class usage in the link from the Adobe documentation.

                       

                       

                      Best regards,

                      Pablo Souza