如何根据用户上传文件来创建文件夹INSISDE服务器?
我有一个表格,用户可以在其中发送1,2,3,...,x文件上传到服务器。当用户第一次上传x文件时,在文件夹中,它必须创建一个新文件夹,其中诸如>版本1
之类的版本时这个新版本从用户上传。
我试图获得类似于图像Bellow的东西。
IAM使用php
,但我认为这是无关紧要的,因为这是一个逻辑问题
I have a form where users can send 1,2,3,...,x files to upload to server. When user uploads x files for first time, inside folder it must create a new folder with versions like version-1
when user uploads new files how can i know what is the current version to create a new folder with this new version uploaded from user.
I am trying to get something similar to image bellow.
Iam using PHP
but i think it's irrelevant because it's a logical problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不久前我遇到了类似的情况。
我的解决方案是我创建一个UUID( https://github.com/ramsey/uuid )我将用作
move_uploaded_file()
的新文件名。然后,我创建了一个DB表,该表存储UUID,原始文件名,用户ID,上传日期和版本编号以及其他需要的内容。
新文件(在我的数据库中还没有名称)将在表中存储为版本1。如果文件已经存在,我抓住最高版本号,添加1,然后写一个新记录。
A while back I ran into a similar situation.
My solution was that I create a UUID (https://github.com/ramsey/uuid) which I will use as the new filename for
move_uploaded_file()
.I then created a DB table that stores the UUID, the original filename, the userId, upload date and version number and whatever else is needed.
New files (don't have the name yet in my DB) will be stored as version 1 in the table. If the file already exists, I grab the highest version number, add 1, and write a new record.