Uploaded files

Output of static files via the system of uploaded files (Robots.txt etc). 

You can configure receiving any file at a specific address.
/Controls/Resource/GetFile?code={code} you can request a certain file at this address + pass additional parameters. 
The contents of the file are formed in the stored procedure rs_{code}_getFile
The management of stored procedures is implemented in thesectionTypes of uploaded files.

CREATE PROCEDURE [dbo].[rs_example_getFile]
    @urlParameters DictionaryParameter READONLY,
    @username nvarchar(32),
    @lang int = 0
    /*The procedure outputs a certain file based on the URL parameters
      (the contents of the file can be taken from the settings or formed
right in the procedure)*/

    /*How to get parameters from a URL
      DECLARE @s nvarchar(128)
      DECLARE @s value from @urlParameters where [key] = 'itemID'*/

    -- output the result
    SELECT top 1 1 Result,
                 '' Msg,
                 value Text, -- file body
                 'text/css' MimeType -- Mime Тип
    FROM as_settings
    WHERE code = 'globalCss'

The following files are managed by default in the system: 

  • Robots.txt - /Controls/Resource/GetFile?code=robots
  • global file JS - /Controls/Resource/GetFile?code=globalJS 
  • global file CSS - /Controls/Resource/GetFile?code=globalCSS
  • the default image of the product in the catalog  - /Controls/Resource/GetFile?code=defaultProductImage.

If necessary, you can configure redirects in the Rewrite URL on IIS for easier file paths. 

Working with graphic files

To work with graphic files, specify them in the encoding Base64 (Use the service https://www.base64-image.de/ to transform images into a line).
File Types image/png, image/jpeg, image/gif

IMPORTANT. The files are cached. Therefore, to get a fresh version of the file, change the link slightly, for example /Controls/Resource/GetFile?code=defaultProductImage&prefix=1
In the future, you can specify this link to the file.
Type of procedure. You can also specify a link to a file on the server, if necessary, instead of data in Text, for example, ‘/uploads/user…’. 
ALTER PROCEDURE [dbo].[rs_defaultProductImage_getFile]
    @urlParameters DictionaryParameter READONLY,
    @username nvarchar(32),
    @langID int = 0
    SELECT top 1 1 Result,
                 '' Msg,
                  hi9g2OTPeOJ2MMbNydw4Oxo9Illjjcvf' text,
                 'image/png' MimeType

If you need a user photo: /Controls/Resource/GetFile?code=userPhoto&user=demo1
If the preview of the user's photo: /Controls/Resource/GetFile?code=userPhoto&user=demo1&thumb=1
Falcon Space is a functional web development platform on a narrow stack MS SQL/Bootstrap. Falcon Space Gettting started