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开发者_如何学Go 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?
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).
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.
精彩评论