├── CSS.h ├── ESP_FIle_download_from_SPIFFS.ino ├── ESP_File_Download_v01.ino ├── Licence.txt ├── Network.h ├── README.md └── Sys_Variables.h /CSS.h: -------------------------------------------------------------------------------- 1 | void append_page_header() { 2 | webpage = F(""); 3 | webpage += F(""); 4 | webpage += F("File Server"); // NOTE: 1em = 16px 5 | webpage += F(""); 6 | webpage += F("

File Server "); webpage += String(ServerVersion) + "

"; 33 | } 34 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 35 | void append_page_footer(){ // Saves repeating many lines of code for HTML page footers 36 | webpage += F(""); 40 | webpage += ""; 43 | webpage += F(""); 44 | } 45 | -------------------------------------------------------------------------------- /ESP_FIle_download_from_SPIFFS.ino: -------------------------------------------------------------------------------- 1 | /* Version 1 2 | 3 | ESP32/ESP8266 example of downloading a file from the device's SPIFFS Filing System 4 | 5 | This software, the ideas and concepts is Copyright (c) David Bird 2018. All rights to this software are reserved. 6 | 7 | Any redistribution or reproduction of any part or all of the contents in any form is prohibited other than the following: 8 | 1. You may print or download to a local hard disk extracts for your personal and non-commercial use only. 9 | 2. You may copy the content to individual third parties for their personal use, but only if you acknowledge the author David Bird as the source of the material. 10 | 3. You may not, except with my express written permission, distribute or commercially exploit the content. 11 | 4. You may not transmit it or store it in any other website or other form of electronic retrieval system for commercial purposes. 12 | 13 | The above copyright ('as annotated') notice and this permission notice shall be included in all copies or substantial portions of the Software and where the 14 | software use is visible to an end-user. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS" FOR PRIVATE USE ONLY, IT IS NOT FOR COMMERCIAL USE IN WHOLE OR PART OR CONCEPT. FOR PERSONAL USE IT IS SUPPLIED WITHOUT WARRANTY 17 | OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | See more at http://www.dsbird.org.uk 21 | 22 | */ 23 | #ifdef ESP8266 24 | #include // Built-in 25 | #include // Built-in 26 | #include // Built-in 27 | #include 28 | #include "FS.h" 29 | #else 30 | #include // Built-in 31 | #include // Built-in 32 | #include // https://github.com/Pedroalbuquerque/ESP32WebServer download and place in your Libraries folder 33 | #include 34 | #include "FS.h" 35 | #endif 36 | 37 | #include "Network.h" 38 | #include "Sys_Variables.h" 39 | #include "CSS.h" 40 | #include 41 | 42 | #ifdef ESP8266 43 | ESP8266WiFiMulti wifiMulti; 44 | ESP8266WebServer server(80); 45 | #else 46 | WiFiMulti wifiMulti; 47 | ESP32WebServer server(80); 48 | #endif 49 | 50 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 51 | void setup(void) { 52 | Serial.begin(115200); 53 | if (!WiFi.config(local_IP, gateway, subnet, dns)) { //WiFi.config(ip, gateway, subnet, dns1, dns2); 54 | Serial.println("WiFi STATION Failed to configure Correctly"); 55 | } 56 | wifiMulti.addAP(ssid_1, password_1); // add Wi-Fi networks you want to connect to, it connects strongest to weakest 57 | wifiMulti.addAP(ssid_2, password_2); // Adjust the values in the Network tab 58 | wifiMulti.addAP(ssid_3, password_3); 59 | wifiMulti.addAP(ssid_4, password_4); // You don't need 4 entries, this is for example! 60 | 61 | Serial.println("Connecting ..."); 62 | while (wifiMulti.run() != WL_CONNECTED) { // Wait for the Wi-Fi to connect: scan for Wi-Fi networks, and connect to the strongest of the networks above 63 | delay(250); Serial.print('.'); 64 | } 65 | Serial.println("\nConnected to " + WiFi.SSID() + " Use IP address: " + WiFi.localIP().toString()); // Report which SSID and IP is in use 66 | // The logical name http://fileserver.local will also access the device if you have 'Bonjour' running or your system supports multicast dns 67 | if (!MDNS.begin(servername)) { // Set your preferred server name, if you use "myserver" the address would be http://myserver.local/ 68 | Serial.println(F("Error setting up MDNS responder!")); 69 | ESP.restart(); 70 | } 71 | #ifdef ESP32 72 | // Note: SD_Card readers on the ESP32 will NOT work unless there is a pull-up on MISO, either do this or wire one on (1K to 4K7) 73 | Serial.println(MISO); 74 | pinMode(19, INPUT_PULLUP); 75 | #endif 76 | Serial.print(F("Initializing SD card...")); 77 | SPIFFS.begin(); // Start the SPI Flash Files System 78 | // Note: Using the ESP32 and SD_Card readers requires a 1K to 4K7 pull-up to 3v3 on the MISO line, otherwise they do-not function. 79 | //---------------------------------------------------------------------- 80 | ///////////////////////////// Server Commands 81 | server.on("/", HomePage); 82 | server.on("/download", File_Download); 83 | ///////////////////////////// End of Request commands 84 | server.begin(); 85 | Serial.println("HTTP server started"); 86 | } 87 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 88 | void loop(void) { 89 | server.handleClient(); // Listen for client connections 90 | } 91 | 92 | // All supporting functions from here... 93 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 94 | void HomePage() { 95 | SendHTML_Header(); 96 | webpage += F(""); 97 | append_page_footer(); 98 | SendHTML_Content(); 99 | SendHTML_Stop(); // Stop is needed because no content length was sent 100 | } 101 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 102 | void File_Download() { // This gets called twice, the first pass selects the input, the second pass then processes the command line arguments 103 | if (server.args() > 0 ) { // Arguments were received 104 | if (server.hasArg("download")) SD_file_download(server.arg(0)); 105 | } 106 | else SelectInput("File Download", "Enter filename to download", "download", "download"); 107 | } 108 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 109 | void SD_file_download(String filename) { 110 | File download = SPIFFS.open("/" + filename, "r"); 111 | if (download) { 112 | server.sendHeader("Content-Type", "text/text"); 113 | server.sendHeader("Content-Disposition", "attachment; filename=" + filename); 114 | server.sendHeader("Connection", "close"); 115 | server.streamFile(download, "application/octet-stream"); 116 | download.close(); 117 | } else ReportFileNotPresent("download"); 118 | } 119 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 120 | void SendHTML_Header() { 121 | server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); 122 | server.sendHeader("Pragma", "no-cache"); 123 | server.sendHeader("Expires", "-1"); 124 | server.setContentLength(CONTENT_LENGTH_UNKNOWN); 125 | server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. 126 | append_page_header(); 127 | server.sendContent(webpage); 128 | webpage = ""; 129 | } 130 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 131 | void SendHTML_Content() { 132 | server.sendContent(webpage); 133 | webpage = ""; 134 | } 135 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 136 | void SendHTML_Stop() { 137 | server.sendContent(""); 138 | server.client().stop(); // Stop is needed because no content length was sent 139 | } 140 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 141 | void SelectInput(String heading1, String heading2, String command, String arg_calling_name) { 142 | SendHTML_Header(); 143 | webpage += F("

"); webpage += heading1 + "


"; 144 | webpage += F("

"); webpage += heading2 + "

"; 145 | webpage += F("
"; // Must match the calling argument e.g. '/chart' calls '/chart' after selection but with arguments! 146 | webpage += F("
"); 147 | webpage += F("

"); 148 | append_page_footer(); 149 | SendHTML_Content(); 150 | SendHTML_Stop(); 151 | } 152 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 153 | void ReportFileNotPresent(String target) { 154 | SendHTML_Header(); 155 | webpage += F("

File does not exist

"); 156 | webpage += F("[Back]

"; 157 | append_page_footer(); 158 | SendHTML_Content(); 159 | SendHTML_Stop(); 160 | } 161 | -------------------------------------------------------------------------------- /ESP_File_Download_v01.ino: -------------------------------------------------------------------------------- 1 | /* Version 1 2 | * 3 | * ESP32/ESP8266 example of downloading a file from the device's SD Filing System 4 | * 5 | This software, the ideas and concepts is Copyright (c) David Bird 2018. All rights to this software are reserved. 6 | 7 | Any redistribution or reproduction of any part or all of the contents in any form is prohibited other than the following: 8 | 1. You may print or download to a local hard disk extracts for your personal and non-commercial use only. 9 | 2. You may copy the content to individual third parties for their personal use, but only if you acknowledge the author David Bird as the source of the material. 10 | 3. You may not, except with my express written permission, distribute or commercially exploit the content. 11 | 4. You may not transmit it or store it in any other website or other form of electronic retrieval system for commercial purposes. 12 | 13 | The above copyright ('as annotated') notice and this permission notice shall be included in all copies or substantial portions of the Software and where the 14 | software use is visible to an end-user. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS" FOR PRIVATE USE ONLY, IT IS NOT FOR COMMERCIAL USE IN WHOLE OR PART OR CONCEPT. FOR PERSONAL USE IT IS SUPPLIED WITHOUT WARRANTY 17 | OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | See more at http://www.dsbird.org.uk 21 | * 22 | */ 23 | #ifdef ESP8266 24 | #include // Built-in 25 | #include // Built-in 26 | #include // Built-in 27 | #include 28 | #else 29 | #include // Built-in 30 | #include // Built-in 31 | #include // https://github.com/Pedroalbuquerque/ESP32WebServer download and place in your Libraries folder 32 | #include 33 | #include "FS.h" 34 | #endif 35 | 36 | #include "Network.h" 37 | #include "Sys_Variables.h" 38 | #include "CSS.h" 39 | #include 40 | #include 41 | 42 | #ifdef ESP8266 43 | ESP8266WiFiMulti wifiMulti; 44 | ESP8266WebServer server(80); 45 | #else 46 | WiFiMulti wifiMulti; 47 | ESP32WebServer server(80); 48 | #endif 49 | 50 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 51 | void setup(void){ 52 | Serial.begin(115200); 53 | if (!WiFi.config(local_IP, gateway, subnet, dns)) { //WiFi.config(ip, gateway, subnet, dns1, dns2); 54 | Serial.println("WiFi STATION Failed to configure Correctly"); 55 | } 56 | wifiMulti.addAP(ssid_1, password_1); // add Wi-Fi networks you want to connect to, it connects strongest to weakest 57 | wifiMulti.addAP(ssid_2, password_2); // Adjust the values in the Network tab 58 | wifiMulti.addAP(ssid_3, password_3); 59 | wifiMulti.addAP(ssid_4, password_4); // You don't need 4 entries, this is for example! 60 | 61 | Serial.println("Connecting ..."); 62 | while (wifiMulti.run() != WL_CONNECTED) { // Wait for the Wi-Fi to connect: scan for Wi-Fi networks, and connect to the strongest of the networks above 63 | delay(250); Serial.print('.'); 64 | } 65 | Serial.println("\nConnected to "+WiFi.SSID()+" Use IP address: "+WiFi.localIP().toString()); // Report which SSID and IP is in use 66 | // The logical name http://fileserver.local will also access the device if you have 'Bonjour' running or your system supports multicast dns 67 | if (!MDNS.begin(servername)) { // Set your preferred server name, if you use "myserver" the address would be http://myserver.local/ 68 | Serial.println(F("Error setting up MDNS responder!")); 69 | ESP.restart(); 70 | } 71 | #ifdef ESP32 72 | // Note: SD_Card readers on the ESP32 will NOT work unless there is a pull-up on MISO, either do this or wire one on (1K to 4K7) 73 | Serial.println(MISO); 74 | pinMode(19,INPUT_PULLUP); 75 | #endif 76 | Serial.print(F("Initializing SD card...")); 77 | if (!SD.begin(SD_CS_pin)) { // see if the card is present and can be initialised. Wemos SD-Card CS uses D8 78 | Serial.println(F("Card failed or not present, no SD Card data logging possible...")); 79 | SD_present = false; 80 | } 81 | else 82 | { 83 | Serial.println(F("Card initialised... file access enabled...")); 84 | SD_present = true; 85 | } 86 | // Note: Using the ESP32 and SD_Card readers requires a 1K to 4K7 pull-up to 3v3 on the MISO line, otherwise they do-not function. 87 | //---------------------------------------------------------------------- 88 | ///////////////////////////// Server Commands 89 | server.on("/", HomePage); 90 | server.on("/download", File_Download); 91 | ///////////////////////////// End of Request commands 92 | server.begin(); 93 | Serial.println("HTTP server started"); 94 | } 95 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 96 | void loop(void){ 97 | server.handleClient(); // Listen for client connections 98 | } 99 | 100 | // All supporting functions from here... 101 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 102 | void HomePage(){ 103 | SendHTML_Header(); 104 | webpage += F(""); 105 | append_page_footer(); 106 | SendHTML_Content(); 107 | SendHTML_Stop(); // Stop is needed because no content length was sent 108 | } 109 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 | void File_Download(){ // This gets called twice, the first pass selects the input, the second pass then processes the command line arguments 111 | if (server.args() > 0 ) { // Arguments were received 112 | if (server.hasArg("download")) SD_file_download(server.arg(0)); 113 | } 114 | else SelectInput("File Download","Enter filename to download","download","download"); 115 | } 116 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117 | void SD_file_download(String filename){ 118 | if (SD_present) { 119 | File download = SD.open("/"+filename); 120 | if (download) { 121 | server.sendHeader("Content-Type", "text/text"); 122 | server.sendHeader("Content-Disposition", "attachment; filename="+filename); 123 | server.sendHeader("Connection", "close"); 124 | server.streamFile(download, "application/octet-stream"); 125 | download.close(); 126 | } else ReportFileNotPresent("download"); 127 | } else ReportSDNotPresent(); 128 | } 129 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 130 | void SendHTML_Header(){ 131 | server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); 132 | server.sendHeader("Pragma", "no-cache"); 133 | server.sendHeader("Expires", "-1"); 134 | server.setContentLength(CONTENT_LENGTH_UNKNOWN); 135 | server.send(200, "text/html", ""); // Empty content inhibits Content-length header so we have to close the socket ourselves. 136 | append_page_header(); 137 | server.sendContent(webpage); 138 | webpage = ""; 139 | } 140 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 141 | void SendHTML_Content(){ 142 | server.sendContent(webpage); 143 | webpage = ""; 144 | } 145 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 146 | void SendHTML_Stop(){ 147 | server.sendContent(""); 148 | server.client().stop(); // Stop is needed because no content length was sent 149 | } 150 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 151 | void SelectInput(String heading1, String heading2, String command, String arg_calling_name){ 152 | SendHTML_Header(); 153 | webpage += F("

");webpage += heading1+"


"; 154 | webpage += F("

"); webpage += heading2 + "

"; 155 | webpage += F(""; // Must match the calling argument e.g. '/chart' calls '/chart' after selection but with arguments! 156 | webpage += F("
"); 157 | webpage += F("

"); 158 | append_page_footer(); 159 | SendHTML_Content(); 160 | SendHTML_Stop(); 161 | } 162 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 163 | void ReportSDNotPresent(){ 164 | SendHTML_Header(); 165 | webpage += F("

No SD Card present

"); 166 | webpage += F("[Back]

"); 167 | append_page_footer(); 168 | SendHTML_Content(); 169 | SendHTML_Stop(); 170 | } 171 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 172 | void ReportFileNotPresent(String target){ 173 | SendHTML_Header(); 174 | webpage += F("

File does not exist

"); 175 | webpage += F("[Back]

"; 176 | append_page_footer(); 177 | SendHTML_Content(); 178 | SendHTML_Stop(); 179 | } 180 | 181 | -------------------------------------------------------------------------------- /Licence.txt: -------------------------------------------------------------------------------- 1 | This software, the ideas and concepts is Copyright (c) David Bird 2014 and beyond. 2 | 3 | All rights to this software are reserved. 4 | 5 | It is prohibited to redistribute or reproduce of any part or all of the software contents in any form other than the following: 6 | 7 | 1. You may print or download to a local hard disk extracts for your personal and non-commercial use only. 8 | 9 | 2. You may copy the content to individual third parties for their personal use, but only if you acknowledge the author David Bird as the source of the material. 10 | 11 | 3. You may not, except with my express written permission, distribute or commercially exploit the content. 12 | 13 | 4. You may not transmit it or store it in any other website or other form of electronic retrieval system for commercial purposes. 14 | 15 | 5. You MUST include all of this copyright and permission notice ('as annotated') and this shall be included in all copies or substantial portions of the software and where the software use is visible to an end-user. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS" FOR PRIVATE USE ONLY, IT IS NOT FOR COMMERCIAL USE IN WHOLE OR PART OR CONCEPT. 18 | 19 | FOR PERSONAL USE IT IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | 21 | IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Network.h: -------------------------------------------------------------------------------- 1 | // Adjust the following values to match your needs 2 | // ----------------------------------------------- 3 | #define servername "fileserver" // Set your server's logical name here e.g. if myserver then address is http://myserver.local/ 4 | IPAddress local_IP(192, 168, 0, 150); // Set your server's fixed IP address here 5 | IPAddress gateway(192, 168, 0, 1); // Set your network Gateway usually your Router base address 6 | IPAddress subnet(255, 255, 255, 0); // Set your network sub-network mask here 7 | IPAddress dns(192,168,0,1); // Set your network DNS usually your Router base address 8 | const char ssid_1[] = "your_SSID1"; 9 | const char password_1[] = "your_PASSWORD_for SSID1"; 10 | 11 | const char ssid_2[] = "your_SSID2"; 12 | const char password_2[] = "your_PASSWORD_for SSID2"; 13 | 14 | const char ssid_3[] = "your_SSID3"; 15 | const char password_3[] = "your_PASSWORD_for SSID3"; 16 | 17 | const char ssid_4[] = "your_SSID4"; 18 | const char password_4[] = "your_PASSWORD_for SSID4"; 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESP32-8266-File-Download 2 | Using HTTP and an HTML interface to download files from an ESP32/ESP8266 3 | 4 | 1. Download all files to a sketch folder. 5 | 6 | 2. Edit the Network tab and add in your SSID and PASSWORD, more if you have them. 7 | 8 | 3. Choose your IP address, currently it is fixed to 192.168.0.150 9 | 10 | 4. You can edit the logical name 'fileserver' to your requirements then access the device with http://fileserver.local but only if your browser has mDNS support otherwise use http://192.168.0.150/ 11 | 12 | 5. NOTE: the Directory command is not included in this release, this comes later. 13 | 14 | 6. To test the download place a known file on the SD-Card for trial purposes. 15 | 16 | NOTES: 17 | 18 | The ESP32 is not reliable when using SD Cards, please ensure you know how to connect the SPI bus to the SD-Card if not using an MH-ET Live ESP32 board and a Wemos SD-Card Shield. Although pull-ups are enabled, you may need to add an external 4k7 pull-up too on the MISO line. 19 | 20 | -------------------------------------------------------------------------------- /Sys_Variables.h: -------------------------------------------------------------------------------- 1 | #define ServerVersion "1.0" 2 | String webpage = ""; 3 | bool SD_present = false; 4 | 5 | #ifdef ESP8266 6 | #define SD_CS_pin D8 // The pin on Wemos D1 Mini for SD Card Chip-Select 7 | #else 8 | #define SD_CS_pin 5 // Use pin 5 on MH-T Live ESP32 version of Wemos D1 Mini for SD Card Chip-Select 9 | #endif // Use pin 13 on Wemos ESP32 Pro 10 | 11 | 12 | --------------------------------------------------------------------------------