Table of Contents

File Storage

File Storage


File Storage

File Storage enables users to upload download and manage files.


Configuration


Context

By setting the Context, you associate the File Storage to the Filter.

• Key <Context item>

• Type

fs


Options

• Allowed File Extensions

fs

• Max File Size (MB)


Data

Here you will find saved files with default File Storage references, more filters you use, more columns with references(context keys) will appear.

fs


Default File Storage references

• FileName

• CreatedDate

• CreatedBy


Filtering the column

fs



How to get all file names from a File Storage

The example below shows how to get all file names from a File Storage and insert the file names to "MY TABLE" in the InVision database.


param (
 [Parameter (MANDATORY = $TRUE)][string] $sessionId   
)

$storageName = "My Files"
$fileInfos = [Profitbase.IO.FileStorage]::GetFileInfos($storageName)

$sessionIdSqlParam = New-Object 'Microsoft.Data.SqlClient.SqlParameter'
$sessionIdSqlParam.ParameterName = "@sessionId"
$sessionIdSqlParam.Value = $sessionId

[Profitbase.Data.SqlCommand]::ExecuteNonQuery("DELETE FROM [MY_TABLE] WHERE SessionID = @sessionId", $sessionIdSqlParam)

foreach($fileInfo in $fileInfos)
{  
    $sessionIdSqlParam = New-Object 'Microsoft.Data.SqlClient.SqlParameter'
    $sessionIdSqlParam.ParameterName = "@sessionId"
    $sessionIdSqlParam.Value = $sessionId

    $fileNameSqlParam = New-Object 'Microsoft.Data.SqlClient.SqlParameter'
    $fileNameSqlParam.ParameterName = "@fileName"   
    $fileNameSqlParam.Value = $fileInfo.FileName
   [Profitbase.Data.SqlCommand]::ExecuteNonQuery("INSERT INTO [MY_TABLE] (SessionID, FileName) VALUES(@sessionId, @fileName)", $sessionIdSqlParam, $fileNameSqlParam)
}

See Also


Videos