How to perform file read write operation on server in flex web application? Please guide.
Your help would be appreciated.
How to perform file read write operation on server in flex web application? Please guide.
Your help would be appreciated.
Well it all depends on. Fileread operation is possible in a web application, but filewrite has to be solved with a server side language, like php.
Generally, for reading you can use URLStream, this reads a file into a stream. The easiest usage is:
var ldr:URLStream = new URLStream();
ldr.addEventListener("complete", ldrDone);
ldr.load(new URLRequest(URL_OF_YOUR_FILE));
function ldrDone(evt:*):void
{
//store the file in a bytearray
var bytes:ByteArray = new ByteArray();
evt.target.readBytes(bytes);
trace(bytes);
}
To write files, use php or whatever script. How to write this and what to include in the code really depend on your project.
For flash-related file reading (like loading a swf, or supported image formats, mostly jpg, gif, png natively), use the Loader class.
For text files and xmls, use the URLLoader class.
If you have more questions, feel free to ask.
Depends completely on your backend server technology. PHP, Java, ASP.NET? Either way you use the same server side documentation tutorial on your server side as handling a file upload. On the flex side FileReference.upload does the trick.
See: http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_7.html
http://www.flex888.com/296/9-flex-file-upload-examples-visited.html