diff --git a/mkdocs/acelements.md b/mkdocs/acelements.md index d17ce0e..b3f2c67 100644 --- a/mkdocs/acelements.md +++ b/mkdocs/acelements.md @@ -194,9 +194,9 @@ A `label` is an optional string. A label is always arranged on the left side of Specifies the destination to save the uploaded file. The destination can be specified the following values in the *ACFile_t* enumeration type. -- AC_File_FS: Save as the SPIFFS file in flash of ESP8266/ESP32 module. -- AC_File_SD: Save to an external SD device connected to ESP8266/ESP32 module. -- AC_File_Extern: Pass the content of the uploaded file to the uploader which is declared by the sketch individually. Its uploader must inherit [**AutoConnectUploadHandler**](acupload.md#to-upload-to-a-device-other-than-flash-or-sd) class and implements *_open*, *_write* and *_close* function. +- **`AC_File_FS`** : Save as the SPIFFS file in flash of ESP8266/ESP32 module. +- **`AC_File_SD`** : Save to an external SD device connected to ESP8266/ESP32 module. +- **`AC_File_Extern`** : Pass the content of the uploaded file to the uploader which is declared by the sketch individually. Its uploader must inherit [**AutoConnectUploadHandler**](acupload.md#to-upload-to-a-device-other-than-flash-or-sd) class and implements *_open*, *_write* and *_close* function. !!! note "Built-in uploader is ready." AutoConnect already equips the built-in uploader for saving to the SPIFFS as AC_File_FS and the external SD as AC_File_SD. It is already implemented inside AutoConnect and will store uploaded file automatically. diff --git a/mkdocs/acupload.md b/mkdocs/acupload.md index 83b482a..b7180d0 100644 --- a/mkdocs/acupload.md +++ b/mkdocs/acupload.md @@ -149,19 +149,21 @@ Also, the substance of AC_File_SD (sd) is a FAT file of Arduino SD library porte ## When it will be uploaded -The below diagram shows the file uploading sequence. Upload handler will be launched by ESP8266WebServer/WebServer(ESP32) library which is triggered by receiving an HTTP stream of POST BODY including file content. Its launching occurs before invoking the page handler. +Upload handler will be launched by ESP8266WebServer/WebServer(ESP32) library which is triggered by receiving an HTTP stream of POST BODY including file content. Its launching occurs before invoking the page handler. -At the time of the page handler behaves, the uploaded file already saved to the device, and the [member variables](acelements.md#name_3) of AutoConnectFile reflects the file name and transfer size. +The following diagram illustrates the file uploading sequence: +At the time of the page handler behaves, the uploaded file already saved to the device, and the [member variables](acelements.md#name_3) of AutoConnectFile reflects the file name and transfer size. + ## The file name for the uploaded file AutoConnetFile saves the uploaded file with the file name you selected by `` tag on the browser. The file name used for uploading is stored in the AutoConnetFile's value member, which you can access after uploading. (i.e. In the handler of the destination page by the AutoConnectSubmit element.) You can not save it with a different name. It can be renamed after upload if you need to change the name. -## To upload to a device other than Flash or SD +## Upload to a device other than Flash or SD -You can output the file to any device using a custom uploader by specifying [**extern**](acjson.md#acfile) with the [store](acjson.md#acfile) attribute of AutoConnectFile (or specifying [**AC_File_Extern**](acelements.md#store) for the store member variable) and can customize the uploader according to the need to upload files to other than Flash or SD. Implements your own uploader with inheriting the [**AutoConnectUploadHandler**](#upload-handler-base-class) class which is the base class of the upload handler. +You can output the file to any device using a custom uploader by specifying [**extern**](acjson.md#acfile) with the [store](acjson.md#acfile) attribute of [AutoConnectFile (or specifying [**AC_File_Extern**](acelements.md#store) for the store member variable) and can customize the uploader according to the need to upload files to other than Flash or SD. Implements your own uploader with inheriting the [**AutoConnectUploadHandler**](#upload-handler-base-class) class which is the base class of the upload handler. !!! note "It's not so difficult" Implementing the custom uploader requires a little knowledge of the c++ language. If you are less attuned to programming c++, you may find it difficult. But don't worry. You can make it in various situations by just modifying the sketch skeleton that appears at the end of this page. @@ -205,17 +207,17 @@ typedef struct { -The upload handler needs to implement processing based on the enumeration value of HTTPUpload.status HTTPUploadStatus enum type. HTTPUploadStatus enumeration is as follows: +The upload handler needs to implement processing based on the enumeration value of HTTPUpload.status as **HTTPUploadStatus** enum type. HTTPUploadStatus enumeration is as follows: -- UPLOAD_FILE_START: Invokes to the \_open. -- UPLOAD_FILE_WRITE: Invokes to the \_write. -- UPLOAD_FILE_END: Invokes to the \_close. -- UPLOAD_FILE_ABORTED: Invokes to the \_close. +- **`UPLOAD_FILE_START`** : Invokes to the \_open. +- **`UPLOAD_FILE_WRITE`** : Invokes to the \_write. +- **`UPLOAD_FILE_END`** : Invokes to the \_close. +- **`UPLOAD_FILE_ABORTED`** : Invokes to the \_close. ```cpp protected virtual bool _open(const char* filename, const char* mode) = 0 ``` -The \_open function will be invoked when HTTPUploadStatus is **UPLOAD_FILE_START**. Usually, the implementation of an inherited class will usually open the file. +The \_open function will be invoked when HTTPUploadStatus is **UPLOAD_FILE_START**. Usually, the implementation of an inherited class will open the file.