简体   繁体   English

将用户上传的文件存储在Web服务器中

[英]Storing user uploaded file in the web-server

We are currently developing a web-application that lets user upload their audio files(any audio files,mp3,wav,ogg etc etc). 我们目前正在开发一个网络应用程序,允许用户上传其音频文件(任何音频文件,mp3,wav,ogg等)。

My question is, there are audio files that are not big enough for the database and it is not a good practice, my question is where should I place these audio files? 我的问题是,有些音频文件的大小不足以容纳数据库,这不是一个好习惯,我的问题是应该将这些音频文件放在哪里? Should I place them in a folder in the webserver or are there any alternatives like a file storage for java? 我应该将它们放置在Web服务器的文件夹中,还是有其他替代方法,例如Java的文件存储? Because putting these files in the database is not enough. 因为将这些文件放在数据库中还不够。 I was thinking I'll just place the files in file path in the database. 我当时想我只是将文件放在数据库的文件路径中。 We are currently using tomcat server, and mysql database. 我们当前正在使用tomcat服务器和mysql数据库。

If you are planning to store the file in the web server itself then it may cause issues if you have multiple web servers. 如果您打算将文件存储在Web服务器本身中,那么如果您有多个Web服务器,则可能会导致问题。 So if you want to store the file as it is, create a remote mount and mount it using nfs in all servers with the same path. 因此,如果您想按原样存储文件,请创建一个远程挂载,并在所有具有相同路径的服务器中使用nfs挂载它。 for eg: mount the remote storage in /mnt/audio_mount in all the servers so that you can access it from all servers. 例如:将远程存储安装在所有服务器的/ mnt / audio_mount中,以便可以从所有服务器访问它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM