Skip to main content
Solved

File upload with local storage and subfolder indication

  • December 2, 2024
  • 5 replies
  • 124 views

Freddy
Forum|alt.badge.img+16
  • Thinkwise Local Partner Brasil
  • 528 replies

I'm trying to upload files onto a local storage. Now it's a bit unwanted to have everything in one folder, so i'm trying to incorporate the subfolder like 'contract', but it doesn't seem to be supported. What is the status of supporting the subfolder using the file upload API (Indicium)? It surely cannot be a fixed value only from the SF. 

Best answer by Dick van den Brink

Hi Freddy,

I just tested this on Linux. I created a table, with a "filename" column with the VARCHAR(1024) datatype.
The column uses a domain with the control set to "File upload" and the following base path in the storage provider: /tmp/indicium/files
In my case, I created the /tmp/indicium directory manually - but did not create the files directory.

In the default procedure I hardcoded the filename to the following, to make the test a bit easy: 

    if @cursor_from_col_id = 'filename'
    begin
      set @filename = '/tmp/indicium/files/my-subdir/my-test.txt'
    end

So yes, the base path should be included when setting it from the default and it should also be a child of the one configured in the SF. It is not allowed to have a path in the SF of /tmp/indicium/files and change it in the default to /home/dvdbrink/indicium/files/test.txt.

After the /commit call the files and my-subdir got created and the file was saved correctly.

I hope this gives enough information to make it work on your end. If not, do you get any errors on the /commit call? or what exactly do you mean by "I'm not really getting it to work.".
 

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

5 replies

Forum|alt.badge.img+4

Hello ​@Freddy,

This is supported by Indicium. How are you setting the file path right now? The most likely cause of this not working is that you’re setting a relative path in a default procedure instead of an absolute path.

So instead of this:

set @file = 'sub_folder/file_name.ext';

Try this (where C:\my_storage_location is the base of your storage location):

set @file = 'C:\my_storage_location\sub_folder\file_name.ext'

I hope this helps.


Freddy
Forum|alt.badge.img+16
  • Author
  • Thinkwise Local Partner Brasil
  • 528 replies
  • December 17, 2024
Vincent Doppenberg wrote:

Hello ​@Freddy,

This is supported by Indicium. How are you setting the file path right now? The most likely cause of this not working is that you’re setting a relative path in a default procedure instead of an absolute path.

So instead of this:

set @file = 'sub_folder/file_name.ext';

Try this (where C:\my_storage_location is the base of your storage location):

set @file = 'C:\my_storage_location\sub_folder\file_name.ext'

I hope this helps.

Hi ​@Vincent Doppenberg 

Does this work for linux?  And it should incorporate the base file path?  like 

/var/shared/file/folder/folder/file.pdf

And it will make the folders? Or do they need to exist?  

I'm not really getting it to work. 


Forum|alt.badge.img+3

Hi Freddy,

I just tested this on Linux. I created a table, with a "filename" column with the VARCHAR(1024) datatype.
The column uses a domain with the control set to "File upload" and the following base path in the storage provider: /tmp/indicium/files
In my case, I created the /tmp/indicium directory manually - but did not create the files directory.

In the default procedure I hardcoded the filename to the following, to make the test a bit easy: 

    if @cursor_from_col_id = 'filename'
    begin
      set @filename = '/tmp/indicium/files/my-subdir/my-test.txt'
    end

So yes, the base path should be included when setting it from the default and it should also be a child of the one configured in the SF. It is not allowed to have a path in the SF of /tmp/indicium/files and change it in the default to /home/dvdbrink/indicium/files/test.txt.

After the /commit call the files and my-subdir got created and the file was saved correctly.

I hope this gives enough information to make it work on your end. If not, do you get any errors on the /commit call? or what exactly do you mean by "I'm not really getting it to work.".
 


Freddy
Forum|alt.badge.img+16
  • Author
  • Thinkwise Local Partner Brasil
  • 528 replies
  • January 16, 2025

Hi ​@Dick van den Brink , thanks for the feedback. I will test it soon again and i'll let you know. I think i didn't incorporated the base path and also was fiddling with the subpath in the SF. But good to hear that in should work. 


Jeroen van den Belt
Administrator
Forum|alt.badge.img+9

Hi ​@Freddy,

Are there any updates on this topic, or do you need more time to test this again?


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings