Obviously µC/HTTPs requires a file system for reading files. We suggest using a conventional File system implementation such as µC/FS, It allows to load dynamically the web pages and the web server will be able to receive files. However µC/HTTPs come with a minimalist in-house Static File system, it allows to store only static files (stored in the code space memory). Obviously it is only possible to read and thus it is not possible to upload file to web server when the static file system is used.
µC/HTTPs uses the API defined by µC/TCP-IP Network File System Abstraction Layer (net_fs.h
) to access the file system. It is possible to use µC/HTTPs with other file system by providing an appropriate implementation of the µC/TCP-IP Network File System Abstraction Layer. Example template files to port the file system are available in the µC/TCP-IP Network File System Abstraction Layer directory.
Transferring files to use with µC/HTTPs
Transferring files on the file system for use with the µC/HTTPs module is outside the scope of this document. For this purpose, you could use a FTP server or client, such as µC/FTPs or µC/FTPc, or again use a mass storage media to into your file system.
Note that µC/HTTPs can support file upload when a traditional file system is used. Thus it’s possible to create script to transmit files using the POST method even if no file is yet loaded.
µC/HTTPs provides a small file system that could be allow it to be used without a conventional file system.
The static file system relies on C arrays to represent the various files, and those files are accessible only for reading. µC/HTTPs ships with a very basic web page consisting of a gif and two html files. If you wish to include your own files in this file system, you will have to follow a few simple steps.
First of all, you will have to download a small utility called bin2c.exe
from Micrium’s web site to help you create a C array from any given file. You need to create these arrays for every single file you want to include in this file system. Type bin2c.exe /?
at the command prompt for more information on its usage.
The C array having been generated by this utility then have to be included into your project’s application (see file static_files.h
for complete example). Finally, prior to being able to access the files on the static file system, you need to initialize it and add the files to it, just like it is being done in the listing below.
Static File System Module Configuration
A template for the configuration of the static file system is provided in uC-HTTPs\FS\Static\Cfg\Template\https_fs_static_cfg.h
. If the static file system is being used with µC/HTTPs, the configuration file have to be copied into your application directory and included to your project.
#define HTTPs_FS_CFG_ARG_CHK_EXT_EN DEF_ENABLED
This value configures external argument check feature. You may enable this feature by setting it to DEF_ENABLED
or to DEF_DISABLED
otherwise.
#define HTTPs_FS_CFG_NBR_FILES 5
This value defines the maximum number of files the static file system could manage.
#define HTTPs_FS_CFG_NBR_DIRS 5
This value defines the maximum number of directory the static file system could manage.
#define HTTPs_FS_CFG_MAX_FILE_NAME_LEN 25
This value defines the maximum file name length.