How to store music files using Adobe Air ??
lets say m developing desktop application. in which user ll upload music localy. i want to store that music to my application folder. is it possible ?? n how ??
there is dedicated property in flash.filesystem.File to reflect OS-specific application data location, see:
It would create application specific data storage e.g. in locations like (here on OS X):
You would get data-storage feature for free with that path and api shortcut.
But once you get accustomed to how use native paths, you could consider optimizing that data storage in case you're planning to store several large data assets, see:
i knw abt this application directory.. like wen user ll browse images it ll be stored to application directory by using bytesarray.. so my question is, is there any solution to store music files wen user browse music files ?? i cant use php file to move to my folder as its desktop application.
In AIR runtime you would use flash.filesystem.File class to nearly all work related to files. It wraps methods that allows you to find files, search for them, browser for them, etc. including copying/moving and deleting (files and directories):
This class has properties that are shortcuts to most commonly used paths and additions useful when working with paths in filesystem (like trivial OS-specific separator) and methods you need to learn if you wan't to store files and move them.
The other useful and *core* object from AIR runtime you would use is FileStream I think:
It lets you to write/read content from/to File object. So for example when you get data from some source as bytes - you would save them into local file using combination of flash.filesystem.File and flash.filesystem.FileStream.
you need BLOB type to be defined in table and then just write ByteArray representation of your object into this field in table using UPDATE/SET INSERT SQL methods.
Please try this Adobe's sample to see how JPEG image data is persisted in local database:
(when application starts for the first tiem and there is no .db file - CREATE table statement is used to create empty table that would be later popuplated. JPEG itself is created as result of Camera capture action and converting to JPEG image format - but how you aqauire your data is up to you).
Some people would certianly oppose your plan to store binary content in BLOB fields that way - instead advocating of storing file paths and moving your content into "iTunes" like library data folder managed by database file.
Thanks for the reply. I already thinking to store the link of the file to db but whenever i will update the data, i need to delete the file in the directory and replace it with new one and also for security purpose it can easily be seen.
Im comtemplating to store pdf files on sqlite as blob. Any pros and cons in storing blob data in sqlite?
Thanks a lot.
("Internal Versus External BLOBs in SQLite")
Gather your sample content and then run tests yourself to see if at this point of development performance is serious topic in your application. If you do not notice performance lags on average machine go with your current implementation.
Europe, Middle East and Africa