<p><strong>Found the problem in index.php</strong></p>
<p>The reason why this happened was that the <code>index.php</code> file had, by mistake, one space indentation. the download stream adds those extra spaces and making the files corrupt.</p>

CC BY-SA 4.0
2022-08-25T08:02:38.363Z
2022-08-25T08:02:38.363Z
Slebbo
<p>I have a problem with downloading files from Craft CMS using the &quot;download asset&quot; action on the asset page in the control panel.</p>
<p>These files don't have a public URL and needs to be downloaded this way.</p>
<p>If I check the SHA256 hash of the uploaded file in the asset's folder, it is correct. But when downloading it I get a different hash and in cases of .exe and .zip-files also corrupting and making them unable to run. The zip-files can't be unzipped.</p>
<p>Why does this happening?</p>

<assets><download>
Craft changing/corrupting assets on download?
# Craft changing/corrupting assets on download?

(Asked by: username_0 on 2022-08-23)

I have a problem with downloading files from Craft CMS using the "download asset" action on the asset page in the control panel.

These files don't have a public URL and needs to be downloaded this way.

If I check the SHA256 hash of the uploaded file in the asset's folder, it is correct. But when downloading it I get a different hash and in cases of .exe and .zip-files also corrupting and making them unable to run. The zip-files can't be unzipped.

Why does this happening?

**Tags:** assets, download

---

## 1 answers

### Answer by username_0 on 2022-08-25. Score: 1

**Found the problem in index.php**

The reason why this happened was that the `index.php` file had, by mistake, one space indentation. the download stream adds those extra spaces and making the files corrupt.


---

