cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.88k stars 2.92k forks source link

cannot upload files of folder and files of their subfolder #2552

Closed ChromeFxUI closed 6 years ago

ChromeFxUI commented 6 years ago

Bug Report

cannot upload files of folder and files of their subfolder . But,Google Chrome,FireFox,IE,Edge support.

following code cannot work

public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List<string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback)
{
    if (mode == (mode | CefFileDialogMode.OpenFolder))
    {
        FolderBrowserDialog dialog = new FolderBrowserDialog();
        if (dialog.ShowDialog() == DialogResult.OK)
        {
            filePath = searchDirectory(dialog.SelectedPath);
        }
        filePath = searchDirectory(dialog.SelectedPath);
        callback.Continue(selectedAcceptFilter, filePath);
    }
    else
    {
        OpenFileDialog dialog = new OpenFileDialog();
        dialog.Multiselect = (mode == (mode | CefFileDialogMode.OpenMultiple));
        dialog.Title = title;
        string fileter = "";
        acceptFilters.ForEach((str) =>
        {
            fileter += str + ";";
        });
        dialog.Filter = fileter;
        if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            if (dialog.FileNames.Count() > 0)
            {
                filePath = dialog.FileNames.ToList();
            }
        }
        callback.Continue(selectedAcceptFilter, filePath.ToList());
    }

    return true;
}

private List<string> searchDirectory(string path)
{
    List<string> items = new List<string>();
    items.Add(path);
    DirectoryInfo directoryInfo = new DirectoryInfo(path);
    var curInfo = directoryInfo.GetFileSystemInfos();
    if (curInfo != null && curInfo.Count() > 0)
    {
        foreach (var curItem in curInfo)
        {
            if (curItem.Attributes == FileAttributes.Directory)
            {
                items.AddRange(searchDirectory(curItem.FullName));
            }
            else
            {
                items.Add(curItem.FullName);
            }
        }
    }
    return items;
}

Does CEF not support this function?

welcome[bot] commented 6 years ago

Welcome! We prefer to keep this issue track just for bug reports. If you have a question or need help with something I'd ask that you self close this issue and have a read over https://github.com/cefsharp/CefSharp/blob/master/ISSUE_TEMPLATE.md it contains background information, details on where to ask your questions Gitter or StackOverflow) should be used.

If you're reporting a bug, you must complete the bug report template see https://github.com/cefsharp/CefSharp/blob/master/ISSUE_TEMPLATE.md#bug-report. Please make sure you provide enough detail that someone else can reproduce the issue you are experiencing.

It's also important to remember that CefSharp is just a wrapper around the Chromium Embedded Framework(CEF), a lot of questions people have aren't actually CefSharp specific, they're generic to CEF and for those CEF has it's own support forum at http://magpcss.org/ceforum/index.php and issue tracker at https://bitbucket.org/chromiumembedded/cef

amaitland commented 6 years ago

Issue tracker is for bug reports only, thank you!

If you have a question, ask it on Gitter, StackOverflow or use ceforum (for questions specific to CEF).

amaitland commented 6 years ago

You should ask on ceforum to see if a specific feature you are after is implemented.