Uploadfile returns full path instead of just filename

Post any questions regarding Installing or Upgrading Ebase, including problems starting up the Ebase Xi Server or Designer

Moderators: Dave, Jon, Steve, Ian

fronsky
Ebase User
Posts: 83
Joined: Thu Mar 08, 2018 2:52 pm

Uploadfile returns full path instead of just filename

#1

Postby fronsky » Thu Jan 02, 2020 1:32 pm

It looks like in 5.6 the uploadDile returns now the whole path instead of just the appointed file name (user file name + sequence number if already existing). The path should not be part of this. How can this be solved?

This is the excisting code for upload:


var opts = new UploadOptions();
//
//before 5.6
//opts.directory = system.variables.$ENV_BEA_DOCS_PATH.value;
// since version 5.6
opts.directory = services.file.getUserDataApplicationPath() + java.io.File.separator + "webapp" + java.io.File.separator + "beadocs";
//
form.uploadFileFromBrowser(opts);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Processing resumes here after the upload..
// check for uploaded file
var fileName = system.variables.$FILE_NAME.value;
0 x

Jon
Moderator
Moderator
Posts: 1301
Joined: Wed Sep 12, 2007 12:49 pm

Re: Uploadfile returns full path instead of just filename

#2

Postby Jon » Mon Jan 06, 2020 10:06 am

Which version have you been using where this behavior is different? So far as I can see $FILE_NAME has always returned the full path to the uploaded file. Here is an extract from the system variables documentation, which hasn't been changed for a long time.

$FILE_NAME
Contains the full path of a file created by the system e.g. when creating an XML file using write RESOURCE_NAME, when uploading files using the upload command, or generating PDF documents with the print or PDFPrint commands.
0 x

fronsky
Ebase User
Posts: 83
Joined: Thu Mar 08, 2018 2:52 pm

Re: Uploadfile returns full path instead of just filename

#3

Postby fronsky » Tue Jan 07, 2020 1:28 pm

You're right (ofcource). I checked my code further on. In the old situation I did a string replacement of the full path name (which was in 5.5 in my situation contained in an environment variable) before storing it , because I didn't want it to be stored in the DB. This changed because of the new situation in 5.6. I need to adjust this part of my code also with regard to this.

Thanks for your reply.
0 x


Who is online

Users browsing this forum: No registered users and 1 guest