You are viewing limited content. For full access, please sign in.

Question

Posted to Laserfiche Cloud

Question

Get filename and path of a file in the server

asked on September 24

Hello Community!

I'm currently working on a project where I upload images through a form to a specific location in the repository. My goal is to use these images as objects in a C# SDK script. To achieve this, I need to access the file from the physical disk instead of retrieving it from the Laserfiche repository using a workflow.

Specifically, I need assistance with the following:

  1. How can I retrieve the original filename of the file I saved through the form?
  2. How can I obtain the file path of this image in the server?

 

The only info I am getting from the repository.

Any insights or suggestions would be greatly appreciated. Thank you in advance!

Screenshot 2024-09-23 171108 (1).jpg
0 0

Replies

replied on September 24

You should be accessing them via the SDK - DocumentInfo -> PageInfo.ReadPagePart() - rather than straight from disk. Your volumes should be locked down such that it's not even possible for your script to access those files directly. Even if it's possible, accessing the files directly skips all access control and auditing in the repository, ignores any locks that other users may have, and won't make a new version on modification.

0 0
replied on September 24

Can you leave an c# code example about How I can use DocumentInfo? thanks in advanced!

0 0
replied on September 25 Show version history

I think you need to make use of docInfo.GetPageInfos() or possibly docInfo.GetStatistics() for electronic files.  Then you should have access to .ImageFilePath and .ElecDocumentPath respectively on your return.  Refer to this post for code sample.

You could also obtain the path via an SQL query if that is easier in your build.  This post should provide some guidance for which tables contain the elements you require to build out the path.

0 0
replied on September 24

Where are you running the C# program from?

I would expect to download the file using the SDK, perform some work on it, upload it to a different folder, and move or remove the original.

In that case, you could use the Form ID as the folder name and keep the original file name if needed.

However, if it is a public form, you will want to be careful. There are filename characters that are valid in Linux or Mac that are not in Windows.

0 0
replied on September 24

Hi! I am using SDK to put my C# code and execute this part of the code:

string ldapPath = "LDAP://AD.COM:389";
string userDistinguishedName = "CN=USER, OU=Stakeholder Services,OU=ALL COMPANY,DC=COM";
string photoPath = @"F:\DEVNTEST\DEFAULT\DEFAULT000000\00\00\10\00001042.TIF"; // This is the path of the file I want to get

byte[] photoBytes = CompressAndResizeImage(photoPath, 100 * 1024);

I did not know the Form ID number is the name of the folder Name. Imagine I upload a file called JohnDoe.jpg, how can I get the new saved name of this file when is processed in the form? because in the Page Info section of the file the name of the file is like 00000XXXE.TIF (Like this one 00001042.TIF) Thanks in advanced

0 0
replied on September 25

Sorry if I added or am adding to the confusion.

I am not talking about the underlying folder or file names. I am talking about the Laserfiche folder and file names. Then use the DocumentExporter object in the SDK to export it to the local disk. At that point you can manipulate it as needed. After manipulating it locally, you overwrite the previous file or creating a new file. I normally create new files. That is in the off chance something goes wrong, can try to debug easier.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.