是否可以使用HTML Form / PHP脚本上传文件夹 [英] Is it possible to upload a Folder using HTML Form / PHP script
问题描述
我正在开发一个网站,其中多个图像上传到网站,我正在玩这个可以完成的方式。目前,我有一个PHP脚本,将得到&显示来自给定文件夹的图像,如下所示:
I'm developing a website where multiple images are uploaded to a website and I'm playing around with ways that this can be done. At the moment I have a php script that will get & display images from a given folder which looks like this:
<?php
$dirname = "content/2014/February/";
$images = glob($dirname."*.*");
foreach($images as $image) {
echo '<img src="'.$image.'" /><br />';
}
?>
这可以正常工作,我可以格式化< img>
使用css并将jquery应用于图库,但是,我怎样才能首先使用php和html表单上载图像文件夹?
This works fine and I can format the <img>
using css and apply jquery for the gallery, BUT, how can I upload the folder of images using php and a html form in the first place?
推荐答案
现在可以上传文件夹。您可以通过以下代码完成它:
It is possible to upload a folder now. You can get it done by following below code:
<input type="file" webkitdirectory mozdirectory />
您可以在这里查看演示: https://jsfiddle.net/kevalpadia/vk6Ldzae/
You can check the demo here: https://jsfiddle.net/kevalpadia/vk6Ldzae/
我希望它能帮助你解决你的问题。
I hope it will help you solve your issue.
这篇关于是否可以使用HTML Form / PHP脚本上传文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!