Reputation: 4360
I am planning to start an article based website, where the users will type their articles and upload the images.
Now I am bit confused, in what way I could save the data. Either in database or using the file system as a .txt file or .html file or in any other means. Saving the data in database is causes a little embarrassment for me because initially I plan to run the site in a shared server. So will the shared server capacity be enough for the huge content? Or is it advised so save the content as a separate .txt file or .html file?
Considerations:
a. What are the points to be concentrated to prevent the XSS attack while doing this?
b. If storing in database is the advised solution what should be the datatype? TEXT or LONGTEXT?
Upvotes: 1
Views: 109
Reputation: 23098
This is the 2 most common solutions I can think of:
Both solutions have advantages and drawbacks.
Solution #1: Store everything in the database
Advantages:
Drawbacks:
Solution #2 - Store the "small" data in the database and all attachments outside of the database on the filesystem
Advantages:
Drawbacks:
This is a quick overview of what I can think of. Both solutions can be great, it really depends on how many users will use you project and what hardware is available to you.
For a shared environment I would probably go with #2 since a shared environment is usually not really powerful.
Upvotes: 2
Reputation: 602
I currently faced the same issue. I have millions of profiles and every profiles contains huge data itself. Storing huge data in relational database is not recommended because it slows down site performance. I recommend this solution.
Store data in database which is necessary for searching and initially required for the website. e.g ArticleTitle, tags.
Use NoSQL database (CouchDB) which contains the all information regarding an article. While saving documents in CouchDB, make article id as the name of document so that you can easly map article ids to the article documents.
Upvotes: 1