Can I read and write text file using AS3? - apache-flex

I want to make a registration page with Flex. The data will be stored to text file. is it possible?
please help, thanks in advance.

Flex, in fact, it can read and write text files, but remember that is a client-side language, you can read and write but in the client, not in server, and you need Flash Player Version 10.0 or higher. If you need to write in the server, that as i see you need it, you need a server-language and use a remote object/webservice/httpservice or something like that to transfer the data that you want to store and let the server side make the text file.
Another alternative is use Air, but it is desktop based, not web.
Hope this helps you a bit.

If you're using Adobe AIR, then you can read and write files on the user's machine using the File class.
If you are doing something browser based, then you can write files on the user's client machine using FileReference.save, but it will require user interaction to save the file. If you have limited data, you may be able to store it as a Shared Object. You can use File.browse to get a hook to a file. It requires user interaction, though.
If you need to store data on a server, then Flex cannot help you, but most server side software that I'm aware of should be able to create and read text files on the server. Flex will need to trigger a remote service to do so using RemoteObject, WebService, or HTTPService.

Yes, as long as the file is on a web server.
With that said, it's overkill to create only a registration page in Flex. You'd be better off using html/javascript.

Related

Uploading large files in IIS Asp.net [duplicate]

I've done a good bit of research to find an upload component for .NET that I can use to upload large files, has a progress bar, and can resume the upload of large files. I've come across some components like AjaxUploader, SlickUpload, and PowUpload, to name a few. Each of these options cost money and only PowUpload does the resumable upload, but it does it with a java applet. I'm willing to pay for a component that does those things well, but if I could write it myself that would be best.
I have two questions:
Is it possible to resume a file upload on the client without using flash/java/Silverlight?
Does anyone have some code or a link to an article that explains how to write a .NET HTTPHandler that will allow streaming upload and an ajax progress bar?
Thank you,
Austin
[Edit]
I realized I do need to be able to do resumable file uploads for my project, any suggestions for components that can do that?
1) Is it possible to resume a file upload on the client without using flash/java/Silverlight?
No. The actual HTTP protocol itself does not support resume of partial uploads, so even if you did use flash or silverlight, you'd still need to use something else like FTP on the server.
I've "solved" this problem in the past by writing a custom client application in C# which broke the file down into small chunks (2meg), transmitted those separately, and then the server combines them all back together.
2) Does anyone have some code or a link to an article that explains how to write a .NET HTTPHandler that will allow streaming upload and an ajax progress bar?
While this doesn't solve the 'resume' problem, I've used SWFUpload on the client side and it worked brilliantly. It provides a smart file browser (where you can prompt the user for only jpeg files, etc) and upload progress tracking, all without needing to modify your server at all.
It's not possible to resume an upload using standard HTML file input control, because the whole file gets submitted with the HTTP request.
I've used NeatUpload in the past, which gives you a progress bar. It's under an LGPL license, so you don't need to pay for it and it's open source.
Nothing more to add about the resume problem.
I used (and keep on using) telerik radUpload and I am quite satisfied with it
(it can even be used in medium trust mode which was quite important for me). The only problem I had (and was not able to fix) is to upload files bigger than 2GB...
SlickUpload is pretty solid and a lot of big companies use it from what the site says.
This is probably too late for your project, but POW Upload have now implemented auto resume upload in their new version. We're about to implement it on our site.

How to save a unique file from web browser to the local disk?

We have a Web login feature. We will offer Free calls to a large campaign.
Scenarios:
Because of free calls, we will offer a unique file to be downloaded and stored
After a week or month we will call them and offer them our desktop application to scan and see how trusted, the user is
If we dont find the same file again, we will never start business and more our own statistics
Based on that report we want to do some follow ups campaign
We can do this with cookies but we want user experience and trust analysis
Example:
if you play a music in youtube.com, without notice your file is actually in /tmp/Flash....flv with lot of data on it.
Question:
How can i do the similar using Flex/Flash from the web browser ? Please kindly advise to any link or existing resource..
Thanks in advance.
You cant write file on Client PC trough Flash.
You can use Shared Object which are very similar to Normal Files and they will not be deleted in most cases.
http://learn.adobe.com/wiki/display/Flex/Shared+Objects
Claudio
In short, you can't. Flex in the browser doesn't have any filesystem access.
The only ways to store persistent data from the browser with Flex are through cookies, browser hacks like the evercookie and local shared objects.

IE reading/writing on client end

Is there a way to read and write files on a client's computer using a web based application?
Basically I need to create a internal app that will take two input CSV files and convert it into an output CSV file that is written to the same location as the input files on the client's computers.
Since this is an internal app, I don't have to worry about security. I can easily write a C# app for this but I want to create a ASP.NET app (or any other format). I even looked into creating a HTA application.
Can anyone point me on the right direction to achieve this?
Thanks.
If you want to do it on the client, you will have to write an ActiveX control. You might be able to use Flash or Silverlight, if their security model allows it (I'm not sure).

Flex writing to it’s own directory

I have a Flex application I’m writing (Learning exercise) that I’d like to run of a network drive for many users to access. I’d like users to be able to save high scores on the network.
Users have read write to the network location it's on.
I don’t want to change anything on the computers that might use it (IE install AIR) or IE/Firefox settings. They are just default.
I don’t want to run a server (IE PHP)
Is there anyway to do it?
Cheers
Nope, not without AIR. And even then with difficulty. Flex runs within the context of the browser, and only has available to it the resources available to the browser (for obvious security reasons.)
Flash enjoys a unique position of corporate trust for reliability and safety, and they do everything possible to protect that position. So you're sandboxed.
The best I can think of is put together something that serves a URL and a common or custom read-write protocol - probably not trivial.
You will have to use a backend to access any of those resources. Eg, if you're using BlazeDS then you can just use Java to write to the network. You will have a server anyways to host your application.
You really want to use a backend technology for this. If you're dead set against it, Flash Player 10 can write files to the local filesystem. You could probably trick it to use a network resource by referencing it as a mapped drive or maybe even a named host.
http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html#save()
You can also use the "load()" method of FileReference to read a local file into your Flex application.
I really don't recommend you write in an application using this but it looks like it could be done. The caveat here is that these actions can happen only if the user specifically chooses a location for a file: they need to select the file you want to load or choose the location where a file is saved.

Display the clipboard information in a ASP.net

I am having a requirement to show the data in the clipboard to the readable control.
The clipboard data may be text,document or any type. the control should display the information.
Is there any controls available in ASP.net
This is client side clipboard
You should be able to create and embed a Silverlight 2 control into your webpage. With the correct security setting this should allow you access to the clip board indirectly.
Storing text in the clipboard using Silverlight 2
Getting Started with Silverlight 2
Helpful Blog tutorial on getting started
Which clipboard are you talking about?
The server-side clipboard or the client side clipboard (I assume it to be client side).
From what I know, if you just want to display the info about what is held in clipboard - javascript has Clipboard object that you can use. It might have security constraints (As you are trying to access client side clipboard)
There is no way that the server can possibly read from the client's clipboard. So if you mean what the user has in their clipboard (at the server): it can't be done. You might be able to do some things with javascript, but then ASP.NET becomes largely irrelevant as a detail.
Alternatively, put it this way: have you ever seen this done?
Normally, to get a web-site to do something with non-text data, you need to use a file/upload control (Browse...) to send the data to the server. You might want to investigate this option.
If you need more power at the client, consider Silverlight, Flash, ClickOnce, etc (but try to avoid OCX - that is a dead technology).
It is possible to embed a .NET Windows Forms user control in a web page. Using this you might be able to access the clipboard to make the data available to your web page.
I'm not sure if this would work, for the user control will run with very limited rights, but it could be worth a try.

Resources