我想使用 PHP 将完整的文件夹按原样上传到 Web 服务器上。
我们选择的目录如下:
.\
|-Hello.txt
|-Filen.jpg
|-anotherfile.png
|-File with Spaces.ext
|-Folder -\
|-A file in a Folder.txt
|-Anohter Folder in Folder
-\
|-A file.ext
那么它应该上传为:
web-www/
|-Hello.txt
|-Filen.jpg
|-anotherfile.png
|-File with Spaces.ext
|-Folder -/
|-A file in a Folder.txt
|-Anohter Folder in Folder
-/
|-A file.ext
这意味着它应该在上传到网络服务器时保留文件夹顺序。
我尝试使用一些 PHP 脚本(其中之一是 this )。但它将所有文件(位于文件夹或另一个子文件夹中)上传到同一位置。有进度条就好了。请帮助我!!
最佳答案
这是完全有可能的。我已经使用它有一段时间了,为我一直在构建的一个小应用程序构建一个 ajax 文件夹 uploader 。
我不想这么说,但我不相信(到目前为止)这在 webkit 浏览器之外是可能的。
但是可以使用webkitRelativePath来实现。
http://sapphion.com/2012/06/keep-directory-structure-when-uploading/
关于php - 完全使用 PHP Ajax 上传文件夹并取得进展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10995902/