user41631: I have a simple HTML file that I have uploaded as sketch data using the ESP8266 sketch data upload tool in arduino IDE. The file is 7k in size.
In the set up, I refer to the following function to read the file:
String readTemplatefile(){
  String retval ="";
  File fr = SPIFFS.open("/templatecfg.htm", "r"); 

  if(!SPIFFS.exists("/templatecfg.htm")){

    Serial.println("Template file not available ");  
    }
    while (fr.available()){
        retval += char(fr.read());
      }

fr.close();
Serial.println("Template file = ");    
Serial.println(retval);
return retval;
}

I always get 'Template file not found'. I have   
SPIFFS.begin(); 

at the beginning of the setup function
My board is an ESP8266EX. I have wondered if it the flash size settings in the IDE that could cause this not to be found. Can anyone offer any advice on this issue. I have tried lots of different combinations of Flash size and SPIFF sizes without any luck.
Thanks in advance to any help.

user40731: SPIFFS will always claim to successfully open a file that begins with a slash even if that file does not exist.  Remove the leading slash.

41631: <p>I have a simple HTML file that I have uploaded as sketch data using the ESP8266 sketch data upload tool in arduino IDE. The file is 7k in size.</p>

<p>In the set up, I refer to the following function to read the file:</p>

<pre><code>String readTemplatefile(){
  String retval ="";
  File fr = SPIFFS.open("/templatecfg.htm", "r"); 

  if(!SPIFFS.exists("/templatecfg.htm")){

    Serial.println("Template file not available ");  
    }
    while (fr.available()){
        retval += char(fr.read());
      }

fr.close();
Serial.println("Template file = ");    
Serial.println(retval);
return retval;
}
</code></pre>

<p>I always get 'Template file not found'. I have   </p>

<pre><code>SPIFFS.begin(); 
</code></pre>

<p>at the beginning of the setup function</p>

<p>My board is an ESP8266EX. I have wondered if it the flash size settings in the IDE that could cause this not to be found. Can anyone offer any advice on this issue. I have tried lots of different combinations of Flash size and SPIFF sizes without any luck.</p>

<p>Thanks in advance to any help.</p>
 40731: <p>SPIFFS will always claim to successfully open a file that begins with a slash even if that file does not exist.  Remove the leading slash.</p>
