添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
I want to open a folder dialog on a button click and need that path in a variable so that i can use it to extract all the images in the selected folder.
I am using MVC 4 with razor view . please rply for cshtml page.
I know how to open a file dialog but need a folder dialog.
What I have tried:
This is for file dialog but need to select a folder instead
Select Image <input type="file" name="file" />
<input type="submit" value="Upload Images" name="Command" />
<br /><br />
Filename = @ViewBag.filename
ImageUrl = @ViewBag.ImageURL
If you want to upload an entire folder, then you need to add the multiple and directory attributes to the file input:
<input type= " file" name= " file" accept= " image/*" multiple directory webkitdirectory mozdirectory />
NB: You currently need to include the vendor-prefixed versions of the "directory" attribute as well.
HTMLInputElement.webkitdirectory - Web APIs | MDN [ ^ ]
This is an unofficial extension to the HTML standard. It works in Edge, Firefox, Chrome, and Opera. It doesn't work in any version of IE or Safari, or in mobile browsers.
Can I use... Directory selection from file input [ ^ ]
In browsers that don't support it, the multiple attribute will ensure that users can still select multiple files to upload.
In either case, the Request.Files collection will contain an HttpPostedFile for each posted file.
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •