Using any file type in the file save picker

In Windows 8 you can easily configure the File Open Picker to allow the user to select a file with any type – just use the well-known asterisk:

var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.fileTypeFilter.replaceAll(["*"]);

You can try the same with the File Save Picker as well:

var savePicker = new Windows.Storage.Pickers.FileSavePicker();
savePicker.fileTypeChoices.insert("Any", ["*"]);

However, this raises a runtime error:

0x80070057 – JavaScript runtime error: The parameter is incorrect.

WinRT information: This file picker does not allow the all files extension.

Fortunately there is a nice hack to force the File Save Picker to allow any file type:

savePicker.fileTypeChoices.insert("Any", ["."]);

Technorati-címkék: ,,,

2 thoughts on “Using any file type in the file save picker

  1. Mississauga Soccer

    After looking into a few of the blog posts on your site,
    I honestly like your way of writing a blog. I bookmarked
    it to my bookmark website list and will be checking back in the near future.
    Please visit my web site as well and let me know your opinion.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s