views:

32

answers:

2

Hello,

I have a table in the database containing "files".
I don't know their filetype.
I need to export some stuff (including these files) and be able to import them into the same application. So I was thinking about saving the byte array as data.dat (unknown extension). and when importing just making a byte array from that file and putting it back into the database.

Will this work?

+1  A: 

The extension doesn't influence on the data itself, just the app that will be launched by default when you double-click on it. Yes, it will work.

Just be aware that you should validate the file when importing it to your app.

MeDiCS
+1  A: 

Yes, file extensions are only a clue as to the format/purpose of the file, but don't really mean anything.

From the computer's point of view it doesn't care at all what a file is called (Windows just uses them to associate applications with their files so you can open them by double-clicking).

Paolo