DavidR
DavidR

Reputation: 5388

Best way to handle server-side user files?

I'm trying to make a webapp. The application I am making for myself to help with foreign language translations for classes at my college, and I am hoping to make it available online. All the data that the site saves is in a format like:

section 1
     foreign text
     translated text
section 2
     foreign text
     translated text

The app relies on javascript and jquery, so I thought JSON would be a good format for the data. I've got a basic user system set up, I just need to know the best way to handle the projects. What seems easiest is to just have a directory on my site in which there is a folder for every user. Every user's folder would have an individual file for each project they've made. In the load dialog the php will print the list of files in the user's directory so as to make a list of saved projects.
I don't believe this is the best solution; I'm kind of hacking this together as I go along. Would one giant json file for each user be better, or just a pain to code?

Upvotes: 1

Views: 113

Answers (1)

jeroen
jeroen

Reputation: 91762

I would put everything in a database and not in individual files.

Is there a reason you can´t use a database?

Example:

The simple basic setup with a database would be something with 2 tables:

Users:

  • user_id
  • name
  • etc.

Texts:

  • project_id
  • user_id
  • foreign_text
  • translated_text

Where the foreign_text and translated_text are of type text.

Upvotes: 3

Related Questions