Skip to main content

When using a webpage to upload files to FME server, the files are put in a folder with the username of the fme token instead of the session ID retrieved from 

FMEServer.getSession()

The directories based on session are being created, but the files are stored in the user directory (belonging to the token) instead. The file upload does succeed, the following translation fails because it tries to find the files in the session directory. 

Help!

Let me explain a bit more with some examples:

 

FMEServer.getSession(BuildForm.repository, BuildForm.workspaceName, function(json){
        BuildForm.session = json.serviceResponse.session;
        sessionCode = BuildForm.session;
        BuildForm.path = json.serviceResponse.files.foldera0].path;

results in this response:

{"serviceResponse": {
   "statusInfo": {"status": "success"},
   "session": "35049821",
   "files": {
      "path": "",
      "folder": Â{
         "path": "$(FME_DATA_REPOSITORY)/myworkspace/myworkbench.fmw/35049821",
         "name": ""
      }]
   }
}}

but then, my upload request

$('#fileupload').fileupload({
            url : BuildForm.host + '/fmedataupload/' + BuildForm.repository + '/' +  BuildForm.workspaceName + '&opt_namespace=' + sessionCode,  
             headers : {
                'Authorization' : 'fmetoken token=' + BuildForm.token
                 },
            dropzone : $('#dropzone'),
            autoUpload : true,

gives the following response:

{"serviceResponse": {
   "statusInfo": {"status": "success"},
   "session": "admin",
   "files": {
      "path": "",
      "file": /{
         "size": 162240,
         "name": "myfile.zip"
      }],
      "folder": n{"name": ""}]
   }
}}

 where the session parameter is suddenly "admin" (same as the username of the fme token).

I want this parameter to be the session ID (in this example, 35049821).

 

Thanks!


The symptom seems to be a known bug once occurred in FME Server 2018.0.0.0. Upgrade the FME Server version if you are using 2018.0.0.0, and use the FMEServer.js library version v3.


Hi @flipvandervalk,

this issue could occur if you are using FME Server 2018.0 with FME Server JS API version 1.1 older lower. If you switch to this FME Server JS API version your script should work and the correct files should be found:

 

 

https://api.fmeserver.com/js/v3/FMEServer.js

Reply