Index.html file deleted instantly after upload

Hi,

When I upload my index.html file to the htdocs folder using Filezilla, it appears in the directory and then instantly disappears.

I found another forum post mentioning that this could happen if the filesize exceeds 1mb or if the file contains malware. The file size however is 995kb and I have scanned the file using Microsoft Defender and it found no issues with it.

The index.html file displays in my browser if I double click it on my pc, so it’s definitely correct. It was created using Google Sits and then downloaded as a .html file.

Does anyone have any insight that could help me with this?

Thanks in advance!

I’m pretty sure that’s hitting the 1 MB file size limit. If the limit is being enforced as “1 MB”, not “1 MiB”, then the limit is actually 1 million bytes. If your file is “995 kiB”, it means your file is 995x1024 bytes, which means the size is actually just under 1.019 million bytes, which is over the limit.

Please try reducing the file size to 975 kiB or less and then try uploading it again. That should keep you under the 1 million byte limit.

7 Likes

Ah I see, that makes sense. Thanks so much. I’ll try that now and update if that worked or not.

2 Likes

Hi GGC_Company,

Try to render the page using ajax calls. You can fetch static data by json file, and then rendering repeating page elements using that.

xhttp.onreadystatechange = function() {
  if (this.readyState == 4 && this.status == 200) {
    let json = JSON.parse(this.responseText);
    const target = document.getElementById('target_container');
    // foreach item in json, build element and append to target element
    [...json].forEach(function(elem){
      // elem.append(...)
    })
  }
};
xhttp.open("GET", "your_data.json", true);
xhttp.send();

This way you save bytes, remain static, stays below the file limits, and does not require PHP.

If you do not want to involve js ajax, then convert the html to PHP and use PHP foreach loop on a static array instead.

Cheers!

Yep! Can confirm that was the issue. I just re-created the website using a different website builder instead of Google Sites, as it’s only a landing page I have anyway and the .html file size is much smaller and uploaded fine.

All working, and resolved! Appreciate the help, thanks!

3 Likes

Thanks for the insight, that’s good to know for future definitely. I appreciate your input. :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.