Why are my files being deleted?
You have successfully uploaded a file, and then notice that it has diappeared. What could have caused this?
You don’t have a htdocs folder.
You must upload all of your website files to the htdocs folder that is specific for the domain, this may be /htdocs/, /yourdomain.com/htdocs/, etc.
You can’t upload file outside of the htdocs folder for security reasons. However, you can upload them in subdirectories in the htdocs folder. If you try to upload a file/directory via FTP or create a file/directory via PHP, and the file/directory is outside of the permitted locations described above, you will either have an error thrown or the file/directory will be immediately removed.
The file type you’re trying to upload is not allowed.
For various reasons, including but not limited to security and fair usage, various filetypes, such as .exe, .pdf, as well as others, are prohibited. However, website file(types) are allowed. These can include: .html, .php, .js, .css, .jpg, .png, etc.
If you would like to make a file available for downloading, we ask that you do so through an external service dedicated to file sharing, such as Google Drive. If you would like to include a video on your site, we also ask that you make it available through an external service dedicated to video hosting, such as YouTube.
Malware may be present in the file(s).
We have a script immediately executed after you upload a file. This script checks for malware. If the script finds malware in a file, the file is immediately deleted.
The file exceeds the size limit.
We limit the file size on our servers to ensure that everyone’s content can load quickly. Files which exceed the upload size are automatically removed. File size restrictions by type are as follows:
- HTML/PHP/plaintext files are limited to 1 MB.
- Expanding on the above,
.htaccessfiles are limited to 10 kB. - All other files, such as images, are limited to 10 MB.
These file size restrictions apply to all files, no matter how your site acquires the file. PHP $_FILES uploads are subject to the above regulations.
Suggestions to reduce HTML and PHP file sizes
If you are finding that your PHP and HTML files are too big, we have some tips on how to reduce their size:
- If your file has a lot of embedded CSS or JavaScript, you may want to consider making those their own respective files.
- If your page has a lot of dynamic or static data, consider moving it to separate files or into a MySQL database. Note that databases must be acccessed with PHP.
- If the PHP file contains a lot of lines, you may want to group different parts and
includeorrequirethem from a separate file.
Suggestions to reduce other filetype sizes
- To upload an archive (.zip, .rar, .tar.*z), unarchive the file locally on your computer and upload the unarchived files via FTP.
- Using better encoding or better compression can also lower media file sizes.
- For non-html items, such as images, we recommend CDN or static hosting from a dedicated service, such as JSdelivr (text) or Statically (images).
Suggestions to reduce the .htaccess file size
Large .htaccess files have a negative impact on server speed because it takes Apache longer to parse. Below are some scenarios and solutions.
- You want to block bots from accessing your site.
Parsing User Agents is an effective way to block bots, but we already have a security security system to deny access to bots. We recommend removeing .htaccess code which does this.
- You want to limit prevent access from certain countries/areas.
While this is possible in the .htaccess, we do not recommend it. It can create a very large file. We recommend moving the blocking code to PHP code, where you can have easier control, a larger file type, and debugging is easier and more leanient. However, Ip blocking can become hard and potentially problematic.
- You have many
RewriteRules.
While RewriteRules are handy, using more than 10 can become hard to manage and can potentially slow your site. URL routing is handled within PHP in lots of frameworks, and we highly recommend this option.
“Why Are My Files Being Removed after They’ve Been Uploaded? - ProFreeHost.” Profreehost.com, profreehost.com/support/files-and-directories/files-removed-after-upload. Accessed 29 Jan. 2022.
Docs