我想从PHP代码中获取计算机中的文件夹名称。关于stackoverflow的搜索,我得到了以下信息:
<input type="file" name="folder" webkitdirectory directory multiple/>
Directory Chooser in HTML page
但是,问题是文件夹在post数组中只提供一个文件名。
<?php
echo "I am in page.";
if ( empty($_POST['folder']))
{
?>
<form method="POST">
<div class="container compare_body">
<div class="row">
<div class="col-md-3">
Select a Folder:
</div>
<div class="col-md-3">
<input type="file" name="folder" webkitdirectory directory multiple/>
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-info">List your files</button>
</div>
</div>
</div>
</form>
<?php
}
else
{
print_r($_POST['folder']);
echo "I am in else.";
}
?>
我在页面.WWW.YIFY-TORRENTS.COM.jpg我在其他地方。
编辑:我尝试了GET
方法,这会导致以下查询:
http://localhost/thrillermovie/yourmovies?folder=2.png&folder=facebook_post.png&folder=callhistorycontrol.png&folder=khan.jpg&folder=minimization.png&folder=obama_knows.png&folder=facebook.png&folder=wildkrafts.png&folder=dekho.png&folder=sub.png&folder=2_batman.png&folder=best+response.png&folder=moore.png&folder=admob.png&folder=adrspeechcode.png&folder=batman_story.png&folder=comparemovies.png&folder=landevicefound.png&folder=it&folder=device-2015-08-19-005229.png&folder=bhakta.png&folder=Screenshot+from+2015-09-19+23%3A16%3A09.png&folder=arrow.png&folder=raghib_comment.png&folder=web_hi_res_512.png&folder=nfa_dfa.png&folder=raghiblul.png&folder=tux.png&folder=lexical.png&folder=likes.png&folder=raghib_lul.png&folder=bluegape.png&folder=con.png&folder=dfa_conversion.png&folder=bhakto+ko.png&folder=mynumber.png&folder=katjuJiReply.png&folder=tifY9AWf_400x400.jpg&folder=kalam.jpg&folder=bk.png&folder=1.png&folder=1_batman.png&folder=mealay.png
但输出只是最后一个文件夹名称。
请帮我解决问题。
答案 0 :(得分:1)
尝试使用表单名称{{1}},然后在foreach文件夹中处理