Is there a way where I can keep counts on how many anonymous and authenticated users download a file in my website? The downloaded link is just hyper-linked to the file itself in the server:
sites/defaults/files/file.pdf
Thank you very much for the response.
Use the Download Count module
you could also use the public download count module for download counts from public folders
As far as restricting the downloads, I don't think there is a module out there but you could build your own
Related
I have Drupal 7 website and i need to upgrade it to Drupal 8 i’ve followed drupal website documentation for upgrading to drupal 8 using web browser https://www.drupal.org/docs/8/upgrade/upgrade-using-web-browser#source-site
Now both sites installed in the same server with different domains.
When i added database access all data migrated successfully else the media files because I have an error in public file directory input i’ve tried the following directories but each one return error.
1- When I added public files directory with the website address as https://drupal7migration.mydomain.com/sites/default/files
Or
https://drupal7migration.mydomain.com/sites/default/files
the error was unable to read from public files directory. Client error 'Head https://drupal7migration.mydomain.com/sites/default/files' resulted in a 404 not found response.
2- When I added the local file directory: /var/www/vhosts/drupal7migration.mydomain.com/httpdocs/sites/default/files
Or
/var/www/vhosts/drupal7migration.mydomain.com/httpdocs/sites/default/files/public
Or
/var/www/vhosts/drupal7migration.mydomain.com/httpdocs/sites/default/public
the error was "unable to read from public files directory".
also the sites folder has 777 permission.
So, what’s the right public file directory that should be added to migrate both database and files successfully?
The files folder usually lives in :
/sites/yourSite/files.
Given the errors you indicated, it sounds like the “web server” doesn’t have enough permissions to the /sites/yourSite/files (read, write , and execute).
So determine the user under which your web server is running and make sure that use has enough permission.
See docs for more:
https://www.drupal.org/docs/7/install/setting-up-the-files-directory
Also, look at your web server vhost to get the actual documentRoot location.
I don’t think what you have is correct:
/var/www/vhosts/drupal7migration.mydomain.com/httpdocs/sites/default/files
Is probably meant to be
/var/www/vhosts/drupal7migration.mydomain.com/sites/default/files
Normally,
You have /
var/www/HTML/example.com
Point
to your Drupal install as:
/
yourDrupalInstall/sites/example.com
Or
/yourDrupalInstall/sites/default
/files
i want to protect some files in a folder by requiring passwords for download
however list of users that are allowed to download are on a mysql table with their passwords in md5 format (which means i cannot generate a htpasswd file)
to make it harder i also need to allow some users to download some files and others to download other files without being able to move files (separating files in multiple folders)
so i what i need is some kind of auth api , when there is a request nginx askes a Script (lets say a php script) with parameters of username/password/ip/filename and depending on script's response allow or disallow the download
is this possible?
what i've done so far:
1.looking in the 3rd party modules list http://wiki.nginx.org/3rdPartyModules
where i found a module with PAM but my server is windows
2.googling lots of terms without any results
3.looking at the module development tutorials http://www.evanmiller.org/nginx-modules-guide.html
i'm not really good at C so a pre made module for windows that bounces the request to a script (without proxy-ing the download through it) is the best if not some pointers to how should i make a module that meets my requirements is appreciated .
You can use the http_auth_request module.
p.s. Do you actually know that nginx for windows is not production ready?
Is there a way to restrict content download "Restricting Anonymous Users From Downloading Files"
Right now, once the user is logged in and he is able to obtain the URL to a path, he can re-download it again even if he logs off.
We've tried
-Rules Module and Content_Access Module to no avail.
it only supports:
Basic Rules per node
There's no
Basic Rules per Content (i.e. videos)
You can control access to files via Drupal only if both conditions are met:
private mode is on (see /admin/config/media/file-system)
Download folder is outside web server access, i.e. file upload folder contents are not accessible from the web.
See hook hook_file_download() which is called for every private file.
Control access to private file downloads and specify HTTP headers.
This hook allows modules enforce permissions on file downloads when the private file download method is selected. Modules can also provide headers to specify information like the file's name or MIME type.
I'm looking for a Bundle for Symfony2 which will allow specific user access to download files like .zip .pdf. Users can login and download files that they are authorized to access.As long as the user is "Authenticated" and have the correct roles.
I would also like the ability to send someone a download URL which has a specific life time, and dies once the download has been successful.
I have looked on packagist.org and the nearest I can find is chilldev/file-manager-bundle, However it does not have the access control and URL generation. I have also looked in knpbundles.com and could not find anything.
Does anyone know of a bundle which has the type of functionality? It will save me a load of development time.
IMHO there is no such bundle. You need to code the security stuff on your own or try to combine some existing bundles.
Worth to have a look at:
Sonata Project https://github.com/sonata-project
FriendsOfSymfony https://github.com/FriendsOfSymfony
it may be a bit late but, I recommend checking this bundle: NzoFileDownloaderBundle
I'm working on a College Application project.
I want to ask how to download the files that previously uploaded by user.
Here's the clear view :
User will upload the files.
Controller will handle the request and save the name of the files into database.
How admin can download the file ???
I try to access the localhost/system/files/upload.doc but doesn't got any luck.
Consider using Media views: http://book.cakephp.org/1.3/view/1094/Media-Views
These will allow you to go to a path and load the database information about the file and then present the file with necessary download headers to the user.
yes use media views. They are the best way to keep your files from being publically accessible. So an admin can be "Served" the file and others can not get to them .
You can rename the file and things like that as you serve it to the user as well. Very nice feature of cake.