I am building a community site and i'm currently writing a script that generates thumbnails and stores them on our filesystem.
Should I be storing the avatars in a private directory? or is it OK for that type of file to be in a public assets directory like a CDN?
why or why not?
After searching around and looking at other sites. Google Plus in particular does not save their avatars in a private directory.
In fact, their avatars are accessed from a public CDN and are served up and mixed in with actual search results.
So I guess the answer is no, it isn't necessary to make avatars private
Related
My website includes forms and php code which create pdf files for logged in users. How can I make sure only the appropriate user, the one which generated the files, can access his own files ? Also, the admin user should be able to access these files too.
At the moment, my code creates files in the wp-content/uploads folder, but then any user can access the files generated by the other users, if he can guess the file name... I am OK to create the file in any other folder if required.
I am familiar with command chown and chmod, but I am not sure how to use it in this context. The private folder of each user could be created by my php code.
Thanks for your help,
Ilann
what I did so far: a lot of google searches around "wordpress private folder", "wordpress user-specific folders"...
So I am taking a web development class and in most of my classes they’ve been teaching us to keep our files separate. For instance, I have a public folder and an includes folder. In my includes folder I have my database information and functions. So here is where my issue is: I am trying to post a site in godaddy and when I try to set it up their tech support told me I should place all my files in the public folder. Is that really true? I thought I would need to place my includes(private) folder in another place; if so, where should I be storing it?
GoDaddy may not be the best source of advice. When you SSH into your account (or use the File Manager) you should see your login dir which will IIRC have a www or html dir (and sometimes both, one symlinked to the other). Those are your public webroot/DOCROOT locations. Make a dirtree of your own as a sibling to the www/html dir and use that for your include tree.
When you need the absolute path to your directory tree in order to know where to grab your includes, you can get that from the GoDaddy admin interface - https://support.godaddy.com/help/article/58/finding-your-hosting-accounts-absolute-path
I was recently made aware of meteor private subdirectories. According to the docs: "The private subdirectory is the place for any files that should be accessible to server code but not served to the client, like private data files." I am a newbie at web development in general, so my question is what is the advantage of having these files within the private subdirectory vs. just in the server subdirectory itself? Is the server subdirectory not private - e.g. I have some email templates defined and my email login information is set up in a startup function in the server subdirectory, are these somehow exposed to the client? Any clarification would be very helpful, thanks!
No, your code in the server directory is safe. The difference is on how you use/access those files. Files in your server directory will be loaded/executed on the server, and they would also be difficult to access using the filesystem in the running app. Content of files in your private directory is available as an asset. See http://docs.meteor.com/#assets for full details.
The thing to note is that your server code does not execute in your server directory, but will have a current working directory that is a temporary build directory within .meteor. So if you wanted to use, say, the fs node package to read files in your server directory, you'd first need to find it. Moreover, any new file or a file change in your server directory will trigger meteor to restart your app. There are scenarios where you don't want that. So private gives you a place to handle files that do not affect the execution of the app.
Another way to think about it is that private is for the server what public is for the client.
I have video files (mp4's as I want people to be able to view them on ipads etc.) that I serve to users. However some of these videos are only available to users who have a certain number of user points. I have that working in that if a user doesn't have enough user points they can't view the node. All users have the same role (video viewer) and the problem is that it is possible for someone who has enough user points to view the node, grab the url of the video and then give it to someone who has the video viewer role but doesn't have enough user points and then that person can directly download that mp4.
Just looking for a way to limit access to the mp4 file if a user does not have access to the node or hide the path to the file somehow. I have the mp4's stored in a private file system but this hasn't solved the problem as the users have the same role.
I've got this (http://www.ioncube.com/html_encoder.php) working on static pages in my webspace (non drupal pages) but can't get it working in my drupal setup. When I include the php code in my node to include the php file it just gives me a blank page.
Many thanks
There's not much I could say about this that the Drupal documentation doesn't already.
http://drupal.org/documentation/modules/file#access
Managing file locations and access
When you create a file field, you can specify the sub-directory of the site's file system where uploaded files for this content type will be stored. The site's file system paths are defined on the File system page (Administer > Configuration > Media: File system).
You can also specify whether files are stored in a public directory or in a private file storage area. Files in the public directory can be accessed directly through the web server; when public files are listed, direct links to the files are used and anyone who knows a file's URL can download the file. Files in the private directory are not accessible directly through the web server; when private files are listed, the links are Drupal path requests. This adds to server load and download time, since Drupal must resolve the path for each file download request, but allows for access restrictions.
The best practice for public files is to store them in the multi-site directory like: sites/default/files
The default way to securely add a private directory for your files is to use a directory that can not be accessed directly by your web server, but can be accessed by Drupal. Ideally this directory should be located outside of your Drupal root folder.
The simple way to add a private directory for your files is to create a sub-directory under the public directory like: sites/default/files/private
When you specify the private directory in admin/config/media/file-system it will automatically create the sub-directory & create a simple .htaccess file with Deny from all. This stops Apache from serving files from this directory. Make sure that you test this by adding file to that directory and verifying that you can't browse there directly. If this isn't working, all files in this directory will be accessible to anyone who can guess the URL! Note that non-Apache web servers may need additional configuration to secure private file directories.
Accessing Private Files
Once configured, files stored in the private directory are inaccessible via a direct link; however, if Drupal constructs a link to the file, the file will be accessible to anyone who can see the link.
For example: you have created a new content type with a file field which stores files in your site's private file directory. Next you create a node from this new content type and attach two new files. When the node is published links to both attached files are visible and anyone who can view the node may download the files. Now, if you unpublish the node, all attached files become inaccessible for download even if you use the direct link to the files that worked when the node was published.
Re-publish the node, and disable the "display" checkbox for one of the files. Save the node. Now one file is accessible for public download and the other is not accessible--even if you have the direct URL for the file that is not listed you will not be able to download this file.
For finer grained control of who can see/download attached files you will need an additional access control module. You may write a module yourself, or use a contributed module such as Content Access.
I've a node type created by different users who will be uploading private files.
Now all of whom land in sites/default/files folder which has public access and is visible to the world.
I've tried Private Download module but it can't restrict other users to access one's uploaded files.
I'm using Drupal 6.2
This doesn't use the filefield module, but User Files allows making files private except to the uploading user.
EDIT:
filedepot may work for you. It will allow you to create a folder and only allow that user to access it. I haven't played around with it too much, but it can definitely be a useful tool.