No announcement yet.

Tempory files

  • Filter
  • Time
  • Show
Clear All
new posts

  • Tempory files

    In "Options, Settings, System Folders" there is the option of setting the "Tempory files folder" which is standard set to "/scriptcase/tmp"
    I tried to change this to an folder localy on my pc. But which change you make it stays on the standard folder.
    What I want is not uploading PDF files to the server but that it stay localy. Also for the temp files.
    But again changing the tmp map does not have any effect.
    Kind regards, Bert

  • #2
    Not sure what you want to try. You want to run the application from the server but want the files stored locally?
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Hi Albert,

      To be more detailed:
      I want to store the filename of a pdf in the database en to store the pdf itself in a map on a local machine.
      In fact the pdf is on a local machine (or network share) when starting the proces and should not be transported to the server on which scriptcase is running.
      This I managed with settings in the application (form, application, settings, document path). So far so good.
      But what I want is in the moment that I do with drag and drop (or by choosing the file) the pdf in the form and after push upload, that there is a search in de the database if the file exists.
      When the file exists the metadata in the record should fill the form. After that the user can complete it and submit it for archiving.
      But before submitting and after uploading I see that the pdf comes in "/scriptcase/tmp"
      If there no other ideas for testing if the pdf exist in the database I want to use the fact that er comes a "temp-pdf-file" in the " /scriptcase/tmp" as an event for starting the script
      Second I donot want the file in a "/scriptcase/tmp" on the server. This because of security. I donot want *.pdf on the server. They should stay on the usersite localy.

      Question 1:
      Is there an other way to start a script in this casus.

      Question 2:
      How can I prevent that the *.pdf comes on the server where scriptcase is running.

      I tried to change the setting to "c:/bestanden/tmp" or something like that but you can do what you want but scriptcase stays on "/scriptcase/tmp"

      Hope it is a little more clear now.

      Regards, Bert


      • #4

        The issue is that Scriptcase is running on the server. So if you need to store a pdf locally on a pc you can't use php for that. Php is never able to access directories on your local machine. Of course you can store the local file name in the database, but if you use an upload field for that, the file will be moved to the server. I haven't tried, but if you have a form and display a link c:\mytemp\myfile.pdf then I'm not sure what will happen if you click on it. Will the browser interfere and refuse or warn the user? Easy to try out.

        What you afaik want is that you upload a file to a local directory of your pc. This needs to be done by javascript as php is not in the game here. But security issues in your browser might very well interfere here. Another option is to link in a com server or something similar, something in java, but within SC itself I don't think it's possible.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development /


        • #5
          Hi Albert

          Ok I understand.
          But the main issue is that I want to check the database between upload and submit. So I need an event somehow.
          Second that the change of settings in scriptcase does not have any effect. It is hard coded in sc
          So it would be better that sc not giving the option to change. I see this as mistake in sc.
          The map "/scriptcase/tmp" is growing an growing. I think we do an upload of 1000 till 3000 every week.
          So every month this tmp is growing between 4000 and 12000 pdf's without any function in this case.
          What is the function of the "/scriptcase/tmp" in this?

          The strange thing is that the absolute path of the pdf themselves (not the tmp-files) the y can we stored local.
          When a user has a pdf-viewer installed on his local machine he/she can click on the filenaam in the database and it works fine.
          Again I donot understand the function of the tmp for pdf's.
          Last edited by ctmservice; 09-16-2014, 02:56 PM.


          • #6
            Not sure Bert. The temp folder in dev is fixed, but in deployment you can change using advanced deployment. But I cannot answer the function, I think it's a caching directory for creating stuff, but I'm not sure.
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development


            • #7
              There is only one way in which you can do that, and that is by hacking into the generated php code. And as Albert said, you need advanced deployment for that as well.
              In your deployment paths you should put the upload directory. Normally a file is uploaded to the temp under a certain name (sc_something_somekey.extension) and then moved to the upload you have stored with your deployment. So the temp should then NOT grow from those files.
              I strongly suggest making one directory for uploads and even using subdirectories to keep the speed high. Otherwise your php script would need to work in a dir that is filled with thousands of files, and hence it would be slower then you would need it.
              I have some posts about this where you can hack your code so you can check this out in the advanced search.
              If you make a directory in your webserver space (say and you close access to the outside world then you know someone cant normally download those files but scriptcase properly shows them and allows download.
              Advanced deployment is needed to automatically move the uploaded files to your files storage dir.
              And if you want to be 100% safe you can place the files on another server by creating a link (via the os) in your root drive and by allowing the web service to have read/write access on that dir...
              If you allow scriptcase to automatically create the dirs needed then you can nicely place the files in neat subdirectories (e.g. on user id or project number or so).


              • #8
                Thanks albert and rr
                Now I know I am not overlooking a setting or what.
                Yes I am going to follow the answers and let you know my experiences.
                I want to clear this because it is one of my key-products in business.
                (Creating simple and smart solutions for archiving documents and not stepping in the world of Alfresco, FileNet, Documentum etc)
                Kind regards, Bert


                • #9
                  One last question.

                  Is there an event which I can use in the moment I push the upload-button?
                  This before the insert-button.
                  I want to check before inserting if the document already exists in the database
                  Last edited by ctmservice; 09-17-2014, 10:10 AM.


                  • #10
                    Well you can put an OnChange event on the field. For the rest you can use the standard onvalidate, onbeforeinsert etc...
                    You have to be aware that that in some occasions the file then isnt uploaded yet or the file is already uploaded but exists only in the temp dir.
                    But if you want to check if a file already exists I suggest making an upload form, allowing the upload and then running a custom script and comparing/moving ordeleting the file. I guess that would te simplest way.


                    • #11
                      It could be me, but I donot understand.
                      I have an upload form.
                      In the moment that I pick a file with drag and drop or direct from a map by selecting this file (let say "abcde.pdf") it comes with a red cross before the filename in the upload object.
                      So you can upload now by pusshing the buttom. Then the cross becomes green. This is the action where I want to do something. But so far as I can see, the only thing what happens is that there is comming a file with sc_xxxx_abcde.pdf in the tmp directory.
                      There is nothing else on which I can script than looking on time bases in the tmp directory and try to pick put the file which is new comming in. But that complicated and tricky.
                      The only thing left as far as I can see is to construct my own upload and forget the sc_upload.


                      • #12
                        Be aware that I talk about scriptcase V7, I suspect they made some improvements on SC8.

                        It is normal that if you upload a file with php that the file is first uploaded in a temp dir (see Scriptcase uses the same mechanism. Upload with a temp name in the tmp dir and copy/rename/move the file to the proper dir. This takes a little bit of time (specially on big files).

                        That file that lands in the temporary directory does move to the directory you want, close the window and you'll see it has moved. It has a little delay (in sc7) I have discovered.

                        If you want to code your own uploader I advise jquery file upload. (a totally awesome uploader!) But that is beside the point. I fiddled with it due to the point that I found the standard scriptcase upload not all that good. But I finally returned to using the scriptcase one after looking through all the code that sc generated.

                        My first idea for your problem:
                        you have one field with which you can upload a file to some dir lets call this dir UPLOADS. Once a file is uploaded there you check the file with the ones already uploaded in your storage dir lets call this dir STORAGE. Your green upload button actually saves the file thus in the UPLOADS dir. You use the OnVaildateSuccess to see if it is arrived, then decide if the file is good/duplicate or not and copy/move it to the STORAGE and insert a record there with an insert statement.
                        Then just only allow uploads on the top part and disallow uploads on the bottom part.

                        Just my ideas tho.