Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (13)--thinking

Source: Internet
Author: User
Tags md5 mysql code

Write in front

From the above to update the editing folder, has been thinking about a problem, the previous edit file name has a folder name, but the logical changes, but the saved physical file or folder name is not modified, which leads to the problem is that the file or folder after the name of the physical file can not be found, Because the path or file name is wrong. So I have the thought of this article. Of course, the modification of physical files can be implemented, but will frequently operate IO, performance will be very poor, if a file is very large, you can imagine this efficiency is how bottom.

Series Articles

[Ef]vs15+ef6+mysql Code First mode

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (1)

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (2)--User Registration

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (3)--Verification code

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (4)--Upload Avatar

[Bootstrap]modal Popup box

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--login interface, avatar and other proportional compression

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--page template

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (5)--ajax mode registration

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (6)--ajax mode login

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (7)--File upload

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (8)--File download, delete

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (9)--Edit file name

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (10)--New Folder

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (11)--New Folder 2

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (12)--new folder and upload file

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (13)--Edit folder

Thinking

Today has a better solution, in the database to save the logical data of the file, what is called logical data, such as different paths of files, in the database through the file directory to distinguish the location of the file is different, before we also in the File information table in a field MD5, we all know, The MD5 of the same file is the same. This allows us to store the uploaded files physically in the same directory, regardless of where the files you upload are on the list, and where the server is actually stored in the same directory. Of course this time we can use the file MD5 as the file name. The advantage of this is that different users upload the same file, we can not repeatedly save the file on the hard disk, just in the database, to the user to add a record on the line, of course, this time we need to save a MD5 and the user uploads the real name of the file.

In addition, in this way, for modifying the folder name, we only need to consider the FolderPath field and folder name in the database. There is no need to consider files in the folder.

The third advantage, since there is MD5, for the future of the client to achieve the realization of the second pass laid the foundation.

Clarify the idea, the next step, to achieve this idea.

Actual combat MVC5+EF6+MYSQL Enterprise Network Disk Combat (13)--thinking

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.