views:

284

answers:

1

I'm using Filereference.save() to save a XML file. It's working fine with default filename.But is there a way to force a file extension on the saved file? I'm using "untitled.xml" as the default filename, but if the user changes it to say "myfile", it gets saved as "myfile", rather than "myfile.xml".

+1  A: 

No, you can't. For loading, you can use type filters, but for writing you cannot.

One reason may be security. Many users use the default view of icons in windows, which omits extensions. Thus you could save "myfile.xml.exe" and put malicious binary code into it. But I am just guessing.

greetz
back2dos

back2dos