Is there a way to create a file system like this. Whenever a new user is registered a folder with unique ID is created for storing images in the filesystem for that user. If he/she creates a new album for pictures another new folder will be created inside that unique folder for the user.
Thank U.
You can do that with server-side scripting. For example, with php you can create a new directory using the mkdir() function: http://php.net/manual/en/function.mkdir.php
Beware of scalability issues. I'd recommend you to add another level if indirection, that is, to store user directory in the table. At first you may create directory structure however you like, but when you'll have tens of thousands of directories at one level of filesystem, you could get into filesystem-level performance issues. Then you'll just reorganize your folders, move files, and update table links.
Related
I have an Access database, split into two. One is the front end with all objects, linked to the other database - containing the tables. Both are in the same folder. Locally, the drive is G:. In our other office in another city, the drive is also G:. However, when a colleague in the other office opens the front end database, he gets an error message that it cannot connect locate the G:\ drive for the linked tables. I think there's a difference in the drive name. I know I can add VBA upon the database opening to change the link to that of the current folder. However, if two people in different offices are using the database at the same time, I think that will cause problems as each user would need a different link. Any suggestions will help!
Thanks,
Jeff
You need to map the tables to the explicit folder path. Or the UNC address. It would start with \servername\folder...
I have done this several times, but, access will run very slowly across large distances and outside of a LAN. I would reccomend importing the table if it is used for reference, and create a copy within the front end. Of course, have the front end located on the users PC for fastest accessibility and response. If you are actively working with records in the table, use a query to add and edit records in the table instead of a bound form. Otherwise everything will slow down.
I'm considering storing a working directory (i.e. recursive/nested folder/files) into a mysql database.
The idea is to have a 'projects' table, and a table that contains all folders / files with their corresponding paths in the tree (varchar).
Querying a project should return folders and files as a list of String paths (+some meta-data) that I will use to build the tree at the client.
I should mention that the 'file' records in my working directory are meta-data that represent json files in a mongodb datastore (they describe webpages as complex nested json). File records will be queried more frequently than folders (they don't get queried at all), and will be linked to other tables. Files have a different meaning for my app than folders, which are merely important for my working directory.
My question is what would be the best option:
Store files and folders in separate tables
Store files and folders in the same table (the records will be near identical), and use a FK on a joined table with 2 records "file"/"folder"
Short answer: "classic" relational databases (including mysql) are not very good at this. Here is a good link: Managing hierarchical data in mySQL
On the other hand, Wordpress is an application that does many of the things you're trying to do - and it does it all in mySql (or equivalent RDBMS).
Look here, look especially at the "taxonomies" section.
Another approach might be to look at a graph database, like neo4J.
'Hope that helps ...
Background:
I am making a website where I want modular administrative rights for read/write/edit priviledges. My intent is to allow for any number of access level types, and to base it off of folder structure.
As an example, root admins would have read/write/edit for all site pages. Group A may have read/write/edit to all files in the path www.example.com/section1/ (including subfolders), Group B would have read/write/edit to all files in www.example.com/section2/, and so on.
I have considered two options to impliment this: create a MySQL database that would hold:
Group Name (reference name for the access group)
Read (list of folders the group can read separated by comma)
Write (list of folders the group can write new content to separated by comma)
Edit (list of folders the group can change already existing information separated by comma)
The other option I considered is creating a 'GroupAccess.txt' file somewhere and hand-jamming the information into that to reference.
Question: What are the advanatages of each of these systems? Specifically, what do I gain from putting admin access information in a database versus a text file, and vice versa? (i'm looking for information on potential speed issues, ease of maintainability, ease of editing/changing the information that will be stored)
Note: I'm not looking for a 'which is better', I want to know specific advantages so I can make a better informed decision on what's best for me.
The first thing that comes to mind is that the database would be more secure over a text file for the simple reason a text file can be read over the internet as most web servers serve .txt file by default, this would allow for users with restricted access and non-users of the site to see the whole structure of you site and in turn can make you more open to possible attacks on certain areas of your site.
Another benefit of using a database is that you can easily use a join to check is a user has access to some content in the database where as with a file you'll need to read the file get the permissions and the go build the SQL and get the data from the database.
Those are just two of the things that have stuck out from reading your question, hope it helps.
I have to make a "virtual filesystem" in MySql (using asp.net as the web-application). It's not going to be very complex, probably maximum 2-3 subfolders "deep", with maybe up to 10 files in each folder. Each user will have their own folders and files after they log in. The admin(s) should be able to make "templates", and assign a template to new users. A template will have a few folders and files in it. And this is what I'm scratching my head on how to make. I think I'm at least close to design the tables, but I'm not sure. Here is the tables I've created so far:
Files
ID
Name
ContentType
FileDataSize
FileData
Parent_Folder_ID
Folders
ID
Name
Parent_Folder_ID
Users
ID
Name
Email
Password
Templates
ID
Name
User_Templates
User_ID
Template_ID
Am i on the right track here? Or am I missing something?
This looks pretty simple, and this will probably just work for your purposes.
The only problem you will run into, is that you will need several queries to determine the the full path for a leaf node.
The easiest way to solve this, is to actually store the full path in a separate column, such as:
folder1/folder2/node
Not as pretty, but certainly the absolute easiest to deal with.
Alternatively, you could use the preorder tree traversal algorithm, but this can be more complex, and while fetching sub-tree's is fast, updates may be incredibly slow.
I have tried to look for answers for my question but haven't found anything conclusive.
I have a site which, among other things, stores member pictures & thumbnails. They are in separate directories, and within each directory are a cascade of folder names based on properties of the image. This is to prevent thousands of images being in one directory for performance reasons.
for example, a typical image has a URL like:
www.mysite.com/thumbs/100x75/04/18/s3hf9sj_939swzl.jpg
The file location and name are stored in a mysql database so they can be dynamically displayed.
How would a CDN be implemented for my images? Can I recursively select all the images in a directory to be uploaded to the CDN? How often would it update this file information?
And finally, what might happens when the database retrieves a url like the one above? Will the CDN automatically redirect the user to something like this?
www.cdn.mysite.com/thumbs/100x75/04/18/s3hf9sj_939swzl.jpg
Or will I have to design my database differently?
Thank you.
If you choose to migrate to a CDN and not change your URL scheme you would have to make sure requests to www.mysite.com/thumbs/ are routed to your CDN (at www.cdn.mysite.com/thumbs/).
You also need to change your method of saving images to also save a copy to the CDN, or you could create a synchronization script to run periodically, but then you would need to serve your resources from two locations; from your own if the file is not present on the CDN, which would increase the complexity of your setup.
I would make sure I store my resources directly at my CDN at the same time I backup locally and would migrate to a separate domain form my CDN (to allow more concurrent downloads from the user).