1 Reply Latest reply on Feb 15, 2011 10:33 PM by PowerSlave

    Import script step fails via PHP



      Import script step fails via PHP


      FileMaker Server


      11 advanced

      Operating system version

      Server 2008 32 bit

      Description of the issue

      I have reached a wall with my PHP/Filemaker solution. Here's the breakdown -

      A client can upload a txt/csv file which ultimately will be imported into filemaker pretty much straight away for verification purposes. The PHP page invokes the FMSA script via the newPerformScript command using a script parameter to parse the filename to FMSA. Here's the PHP code that invokes the script :

      $filename = $_FILES["file"]["name"];

        echo "
      Filemaker script has been invoked using script parameter ".$filename." - check to see if the meter reads were imported...


        // Run the script on the server to import the uploaded file of meter reads...

      The above PHP code runs the following script (PHPmeter_import_script) :

      Set Error Capture [On]

      Go to Layout ["PHPmeter_import"](MeterRead_import)

      Enter Browse Mode []

      Set Variable [$meterfilename;Value:Get(ScriptParameter)]

      Set Variable [$meterfilepath;Value:"filewin:/C:/Program Files/FileMaker/FileMaker Server/Data/Documents/" & $meterfilename]

      Import Records[No Dialog;"$meterfilepath";Add;Windows ANSI]

      New Record/Request

      Set Field [MeterRead_import::DealerCode;"Import attempt : script parameter was " & $meterfilepath]

      If I execute this PHP , the FMSA script runs up until the point of the Import Records step , then stops without error , and the remaining 2 script steps are not executed. If I disable the Import Records step , the last 2 lines of the script ARE executed and I get the following text in a new record :

      "Import attempt : script parameter was filewin:/C:/Program Files/FileMaker/FileMaker Server/Data/Documents/Meter3.csv"

      So I know the script parameter is being forwarded from PHP to FMSA , (Meter3.csv was the file I uploaded via PHP) and I know that PHP CAN invoke the script on the server.

      If I setup a schedule in the admin console to run the script with "Meter3.csv" as the script parameter ,and use the "Run Now" option in the admin console, it successfully imports the file as expected. I am getting a little frustrated and confused as I cannot find any documentation or forum posts regarding this issue.

      Here's some versions of what I am using:

      Filemaker Server 11 Advanced ( on Windows 2008 Server Standard (32bit) SP2

      Filemaker API for PHP

      PHP version 5.2.11

      Thanks in advance...

      Regards , Lee.

      Steps to reproduce the problem

      As above

      Expected result

      Import csv / txt file

      Actual result

      Script stops at the import csv step. No error reported

      Exact text of any error message(s) that appear


      Configuration information

      As above