Get saved Documents complete path

Hi everybody,

I am quite new in Scriptcase and I have a doubt concerning the documents saved in tables. The data type in the form is Document (File Name), and it uploads the document in the configured path (*xx/wwwroot/scriptcase/file/doc , in my case). I can see the files correctly saved on my development server. That part is ok.

My problem is when I try to “see” this file, rather than downloading it. I have created a blank app to see the PDF files I upload, and it works great if I type the entire path (*xx/wwwroot/scriptcase/file/doc + filename) but I would like to know, how can I get the full path in order to avoid problems on different environments (develop/production), and I think that also will be important to have into account the subfolder created for each app…

Thanks in advance for you help!

PS: sorry for my poor english, I’m not native

In the port section of the file upload you can specify a Subdirectory folder name.
image

The full path can be found : Note the application name in the variable
$path = $_SESSION[‘scriptcase’][‘application_name’][‘glo_nm_path_doc’]."/hr_information/".

thanks for the answer, but I type it on my blank app at sends me the following errors…

did you replace application_name with your application name?
Can you share the application?

Sure! It is a blank app, to show saved pdf files. If the path is typed manually, it works.

$path = $_SESSION[‘scriptcase’][‘grid_listado_reclamaciones’][‘glo_nm_path_doc’]."/prueba/";

$file = $path . [path_file];

// Header content type
header(‘Content-type: application/pdf’);

header(‘Content-Disposition: inline; filename="’ . $file . ‘"’);

header(‘Content-Transfer-Encoding: binary’);

header(‘Accept-Ranges: bytes’);

// Read the file
@readfile($file);

“/prueba” is the subfolder defined on the form.

Thanks in advance.

What value is assign to [path_file].I fail to see why this concatenate to the path variable.
Perhaps it is the name of the file and not the path.
Also note that for some strange reason the quotes (single) get replaced and exchanged when copy and paste.

Try adding a echo $file to see what is in the $file variable
See attached text file
blank_example.txt (409 Bytes)

That was the point!!! I have corrected the quotes and now works fine!! I spent the whole yesterday due to this!

Thank you very much!!!

$path = $_SESSION[‘scriptcase’][‘application_name’][‘glo_nm_path_doc’]."/hr_information/".

where write this code?

Well it depends where you want to use it.