views:

122

answers:

2

To upload the file using JavaScript generally iFrame approach is used in which Hidden iframe is maintained and then the file is uploaded using the iframe.

However it is said not to be reliable method for the file upload and Flash is used for this purpose. So i am not clear how this is done? I mean by Flash and JavaScript together ?

Also i would like to know if in case there are any other approaches for file upload? like on client side read the file convert into binary data and then send it across or something like that.

Thanks all,

+1  A: 

There is nothing inherently wrong with the iframe approach. Flash based uploading just adds more possibilities, like showing an upload bar, client side image resizing, better and more reliable filtering options (File type / size) and so on.

Flash based uploaders allow the circumvention some of the restrictions that <input type=file> elements have, for example it is possible to fully style the "upload" button.

Check out one of the ready-made solutions to see how they work. My favourites are

Pekka
+2  A: 

So i am not clear how this is done? I mean by Flash and JavaScript together ?

With ExternalInterface (or, more usually, through a pre-rolled Flash object such as YUI Uploader which does all that for you).

i would like to know if in case there are any other approaches for file upload?

Java. ActiveX.

They use the same principles as Flash, but have weaker support.

like on client side read the file convert into binary data

The file is already binary data (unless it is a text file), but read it … how? JavaScript doesn't have access to the filesystem in a standard security context.

David Dorward