Solved

How to upload zip-archive and run workspace?

  • 8 February 2018
  • 3 replies
  • 6 views

Badge

I'd like to create a HTML/javascript site to let users upload a zip-archive and start a job processing this archive on FME Server. The workflow is very similar to the example I found here: https://playground.fmeserver.com/javascript/server-uploads/upload-file-in-session/

 

Using the code from this example I can upload archives (see screenshot). I also checked the resources on FME Server and to me everything appears to be correct - the archive is uploaded to a temporary folder as I expected it to be. However, it isn't "recognized" as a proper input file and when hitting "Run workspace with data" I get an error message saying "No Files Uploaded. Please upload a file."

I already found the suggestion to change the parameter value for "opt_extractarchive" from false to true, but this didn't help anything in my case.

 

Any help is appreciated :-)
icon

Best answer by pallegama 9 February 2018, 04:55

View original

3 replies

Badge

Hi @kgt_lena

I think I have spot the issue.

Problem is in the 'function processFiles( json )'. In the given example file name is being read from the 'files.file' key within returned JSON object (Please see the attached image). However, the file name of zipped files are returned under 'files.archive' key. Therefore altering the Java Script code to assign the value of 'json.serviceResponse.files.archive' to the variable 'files' should solve the issue.

Badge

Hi @kgt_lena,

@pallegama's answer is correct. The processFiles function does not check for any archives and .zip files are stored under the archive key in the service response. I added support for both files & archives to the Data Upload examples on the FME Server Playground.

Please beware that for archives you need to specify the format if you are using a generic writer to make sure the files are read correctly because guessing by extension won't work for .zip files.

Badge

Thanks @pallegama and @GerhardAtSafe! Everything works fine with your modifications :-)

Reply