Jump to content

What is 'download' folder used for?


Recommended Posts

Hello,

 

I can't figure out, what is 'download' folder used for.

I have several shops. 

In some of them it is empty (containing only .htaccess and index.php)

and on one of them it has lots of files with unknown extension. Some of these files are about 3MB. 

What are they used for and is it safe to delete them?

 

Thanks

Link to comment
Share on other sites

Thanks for the answers, vekia and bellini13 :)

 

I have one more question.

Most of my files in 'download' folder are actually pdfs.

So, when I try to open any of these files, they are 'saved as'.

This is the link I use to access a particular file:

../index.php?controller=attachment&id_attachment=xx

My question is: is it possible to open PDFs in browser instead of directly downloading them?

 

It is probably related to Content-Disposition header, but I am not sure how to deal with files, stored as a hash

Link to comment
Share on other sites

you would have to alter the GetFileController, and using the filename (which would include .pdf), you would set the mime type and headers appropriately.

 

You should google that topic for understanding how to force the adobe reader to open, instead of prompting the user to save the file as

Link to comment
Share on other sites

Thanks for advising to look in controllers, however in this case we don't need the GetFileController, but we need the AttachmentController.php. 

 

Here is how I managed to display PDF attachments in browser:

 

replace this:

header('Content-Disposition: attachment; filename="'.utf8_decode($a->file_name).'"');

by this:

if ($a->mime == 'application/pdf'){
header('Content-Disposition: inline; filename="'.utf8_decode($a->file_name).'"');
}
else {
header('Content-Disposition: attachment; filename="'.utf8_decode($a->file_name).'"');
}

In this case only PDFs are opened in browser. All other files are downloaded as regular attachments.

Edited by Amazzing (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...