使用blueimp文件上传时遇到了一个无聊的问题 . 问题是:我的网站上有旋转木马 . 每个Image都有自己的 Headers ,描述和存储在数据库中的其他细节 . 但我没有将图像的url存储在数据库表中 . 图像存储在单独的目录中:

carousels <root dir>
   |
   +---- {carousel_id} <dir> 
   |   |___ image 1 <image file 1>
   |
   +---- {carousel_id} <dir>
       |___ image 1 < image file 1>
       |___ image 2 <image file 2> # Which I do not want

每个目录我只想要一个文件(现在的图像) .

我现在正在做的是,首先我从数据库表中获取所有轮播,并使用carousel_id(这是数据库表中的自动增量主键)找出相关图像 . 但是如果某个目录中有多个文件(例如在dir“1”中),我当前正在随机选择一个图像文件 . 而我所知道的每个旋转木马只能有一个图像 .

In very short: How can I delete other files from the directory when I upload a single file to the same directory successfully using blueimp jquery file-upload.

我在服务器端使用PHP .

请帮我 . 谢谢 .