Community & Support

file upload ~/files directory .htaccess file

I noticed there is a .htaccess file in the ~/files directory. If I don't alter the .htaccess file I get server errors trying to download/view attachments. I deleted the .htaccess file and was able to successfully view/download attachments.

However when I uploaded another attachment the .htaccess came back. I figure this must be part of the internal workings of the module. With the return of .htaccess came the server error when viewing/downloading the attachment.

I opened the file and commented out the only line

#sethandler [some comments that are not commented out]

I can now view/download the attachment again.

Since i know less than .01% about apache I did some research on sethandler and it appears I can use this to set the server behavior for different file types. Currently my site has mp3s. the default behavior when the file is accessed is to open in browser window and begin playing. Is there a way I can use the .htaccess file in the ~/files directory to change the default behavior of mp3s to prompt the user to download the file instead of automatically playing in the browser?

Thank you for your assistance
Jason

Comments

Don't delete files/.htaccess

Servus.

The trick (if you can live with the possible security problem) is to keep ONLY the first line of the Drupal written files/.htaccess -- it's the one with OpenHandler SEE_XXXXX_XXXXXX_XXX_006
(sorry, can't remember the details).
If the system can't find an .htaccess file it will create one, so...

Norbert

-- form follows function

Norbert

-- form follows function

Contents of file/.htaccess

the contents of my is
#SetHandler This_is_a_Drupal_security_line_do_not_remove

I added the # symbol so the files could be accessed. Does anyone have a sample file/.htaccess they could share?

Thx

Great! Now it works for me! Thx a lot.

johnnym

nobody click here