The invention discloses a file storage method which comprises the following steps: S1, acquiring an operation user name K of a currently uploaded file, and defining a value function b (K) of the operation user name K: b (K) = K mod M; taking the operation result of the value function b (K) as the name of the first-level directory; S2, obtaining the month Y of the current year, calculating a valuefunction b (Y) of the month Y: b (Y) = Ymod M, and taking an operation result as the name of a secondary directory; S3, obtaining a file step length variable value n set by the system; S4, obtaining afile name Z of the uploaded file, and calculating a value function P (Z) of the file name Z; S5, performing bitwise AND operation on the P (Z) value obtained in the step S4 and 2n-1 to obtain a nameof a third-level directory; and S6, storing the file in a corresponding directory. According to the method, the user name, the date and the file name are respectively stored in the three levels of directories, so that the problem of excessive files in the same folder when the files are uploaded and stored in the B/S architecture can be solved, the files can be searched in various modes, and the reading efficiency and performance of the files are improved.