MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
439 stars 51 forks source link

default forder for FilePicker dialogbox #2797

Open victorthoang opened 1 year ago

victorthoang commented 1 year ago

Discussed in https://github.com/MicrosoftEdge/WebView2Feedback/discussions/2748

Originally posted by **TranquilleXav** September 2, 2022 Hello Is there a way to set the default folder for opening the FilePicker dialog box? when webview2 profile is new, filepicker opens in documents folder when i browse ans select file, the last folder is memorized. where is it stored? I did not find a file containing this information... and when i force values in registry (via LastVisitedPidlMRU and other keys, I have used this technique before for IE11 and it worked fine), settings in not working with webview2... thank you in advance

AB#41459117

TranquilleXav commented 1 year ago

Hello @victorthoang thank you for your help,

yildirimcagri-msft commented 1 year ago

Hi @TranquilleXav , For the file picker used for downloads you can use CoreWebView2Profile.DefaultDownloadFolderPath property to specify the default download directory (also being the directory the file picker for download will open in when user chooses 'SaveAs'.). However, currently, there is not a way to do it for all file picker instances in WebView2, however I'll add this to our feature request backlog.

TranquilleXav commented 1 year ago

Hello @yildirimcagri

i already use this parameter: WebBrowser.CoreWebView2.Profile.DefaultDownloadFolderPath = WebBrowserCoreWebView2.Profile.ProfilePath & "\download" but it's not that i want, the folder is not "memorized"... and it is bound to the current user. I want to use a generic folder, whatever the user, because this folder is fed elsewhere for everyone...

ok thank for adding this request... but if it's not possible, can you take a look at this? https://github.com/MicrosoftEdge/WebView2Feedback/issues/2650#issue-1328572085

2650

have the ability to intercept the dialogbox launch and replace it with my own...that would be great! and it would make the upload totally secure

thank you very much for the time you devote to this project anyway and have a nice day

nishitha-burman commented 1 year ago

Hi @TranquilleXav,

Can you please describe the scenario you are trying to address?

Thank you, Nishitha

TranquilleXav commented 1 year ago

sorry, I'm going on vacation, I'll come back to you at the beginning of January

TranquilleXav commented 1 year ago

Hello @nishitha-burman thank you for your question. for example, go to this page and click on the input button: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

in fact, i want intercept the opening classic dialogbox and put my own dialogbox, and fix the folder it opens in. the user can select file in the folder and clic on ok button , etc. you can take a look at https://github.com/MicrosoftEdge/WebView2Feedback/issues/1479#issuecomment-1365894371 i'm in discussion about this...

If it is not possible, I want to fix the folder in which the dialog box opens... thank you for your help...

nishitha-burman commented 1 year ago

Hi @TranquilleXav,

Thank you for the details. Can you please clarify what you mean by "fix the folder it opens in"? What issues are you seeing currently?

TranquilleXav commented 1 year ago

Hello @nishitha-burman

currently, when the dialog box opens, it jumps to the last visited folder. I want this dialogbox to always open in the same folder, which I would set programmatically or by parameter... if my explanation is not clear enough, tell me and i will put screenshots.

but the solution I would prefer would be to be able to provide myself the dialog box that appears when the user clicks on the "" button of a website. an event "OnOpenFileDialog" could be triggered, with the possibility of providing a parameter "DefaultOpenFolder"

thank you for help!

nishitha-burman commented 1 year ago

Hi @TranquilleXav,

If you can provide screenshots of the user flow that would be helpful. Thanks!