I still experience this issue when using Internet Explorer 8, even after this fix has been applied. I have an association for the extension php, which causes Internet Explorer to offer repository_ajax.php for download.
PHP 5.2.8-1bunny2 with Suhosin-Patch 0.9.6.3
Internet Explorer 8.0.6001.18702
Windows XP Service Pack 3
Steps to reproduce:
In a course, turn editing on
Add a resource->File
In the section headed "Content", click "Add"
Browse for an attachment, and click "upload this file"
I am prompted to download repository_ajax.php, which contains JSON, e.g.
This is happening when the uploaded file is smaller than post_max_size. I think it is caused by line 67:
This sends the header "Content-Type: text/plain", which causes repository_ajax.php to be downloaded. Commenting out $OUTPUT->header(), which appears to be superfluous, means the content-type is set to "text/html". This is still incorrect – it should be "application/json" – but at least it allows you to upload the file.