W
W
wertex2016-07-26 23:09:28
Yii
wertex, 2016-07-26 23:09:28

How to start working with a file after uploading to the server?

I upload an excel file, so that later I can put the data from it into the database and work with them.
What is the best way to do this?
1. upload to the server
2. create a table for this data
3. open the file and save the data from it to the database
Maybe intermediate steps are needed or should it be done radically differently?
And if we generate a new table in the database for each uploaded file, what should we call it? name + timestamp?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
melnikov_m, 2016-08-25
@melnikov_m

If the file itself is not needed, then after successful parsing of the data and writing it to the database, you can delete the file itself.
I think one table for storing data will be enough if the data from the file can be very different in structure - store them in json format, and name the column "data"
I think the table structure will be something like the following
id - index
user_id - who uploaded
file_name - file name
date - upload date
data - data (json)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question