Announcement

Collapse
No announcement yet.

capture file size and other file information using php

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • capture file size and other file information using php

    I am new to scriptcase and would like to use php filesize() and other file attributes on files I upload. How can I embed php calls in the onbeforeinsert so I can assign these values to fields?

    Your help is appreciated.

    Is there a getting started document on programming within scriptcase?

  • #2
    There are mainly videos. Here on the website of scriptcase and a few on our's (5 minutes for novice). For file upload you don't have to do anything with filesizes except configuring max filesize and filetypes for uploading. Don't do too much, use the strength of SC. Only create php for businessrules and stuff which is not by default supported by SC.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Originally posted by aducom View Post
      There are mainly videos. Here on the website of scriptcase and a few on our's (5 minutes for novice). For file upload you don't have to do anything with filesizes except configuring max filesize and filetypes for uploading. Don't do too much, use the strength of SC. Only create php for businessrules and stuff which is not by default supported by SC.
      Thanks for the info on the videos. My other questions was, I want to capture the file size of the uploaded file, is there a way to do that from within sc?

      Rob

      Comment


      • #4
        Since you have the path of the uploaded file all you need to do is to use the filesize(filename) function

        Comment


        • #5
          Originally posted by rr View Post
          Since you have the path of the uploaded file all you need to do is to use the filesize(filename) function
          How do I reference the filename, if the drag and drop area is used? Is there a variable that the full path and file name is captured?

          Comment


          • #6
            It should be putting the name(s) in a field in the database.

            Comment


            • #7
              Originally posted by adz1111 View Post
              It should be putting the name(s) in a field in the database.
              Yes, the filename is stored in the db - but not full path in which the file lives. Is there a way to get the filesize out of the db blob field?

              Comment


              • #8
                Ok - It's in 2 places.

                The main path for file uploads is in the form's Application | Settings section (Documents Path):

                path.JPG

                However, if you also select the field that is used to upload files, you will also see a place where you can specify a subfolder (Subfolder).

                sf.JPG

                Concatenating them together gives you full file path. Of course if you leave the second part blank then you only need the first part (i.e. the main path).

                Re filesize from DB - not sure - but easy to get use php filesize() on the document in the above path to get that information.

                Code:
                int filesize ( string $filename )
                $filename is full path to the file

                Comment


                • #9
                  with
                  Code:
                  $Size=filesize($this->SC_IMG_FieldName)
                  you can take the size in bits... it works!!!

                  Comment

                  Working...
                  X