incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From filippo dipisa <fili...@dipisa.net>
Subject Re: SFTP file transfer for large files using flex
Date Wed, 28 Mar 2012 19:49:58 GMT
in Air you have the FileStream APi that allows you to stream the file to
the server.
Basically you have to split the file in different chunks and then send to
the server.

here some code example ( I wrote on the fly and didn't test, it is just to
make you understand )

var fileStream:FileStream = new FileStream();
                fileStream.open(yourReferenceToTheUploadedFile,
FileMode.READ);
                fileStream.addEventListener(ProgressEvent.PROGRESS,
yourHandler);
                var byteArraytoSend:ByteArray = new ByteArray();
                var currentLength:int = Math.min(BUFFERSIZE,
fileStream.bytesAvailable);
                var bytesAvailable:uint = fileStream.bytesAvailable -
byteArrayStartPosition;
                var chunk:ByteArray = new ByteArray();
                yourSocketOrRemoteApiToSendTheChunck

With the FileStream I manged to upload really big files and even entire
directories.
With Flex you can use the same architecture using the bytearray but you
risk to crash the browser flashplayer plugin if the file is bigger thatn
1GB and for some Browser even less.

Hope it helps

Filippo


On 28 March 2012 18:34, Marcus Fritze <marcus.fritze@googlemail.com> wrote:

> Hi,
>
> as maybe all know Flash supports only a file size of 100MB.
>
> from the docs:
>
> FileReference -> upload()
>
> > Although Flash Player has no restriction on the size of files you can
> upload or download, the player officially supports uploads or downloads of
> up to 100 MB.
>
> I experienced that an upload / download of a larger file via Flash
> (FileReference) is possible.
>
> I agree with Avinash! I think this is a good place to discuss this topic
> (and not the stack overflow forum). Because this mailing list is the place
> where we can improve the Flex SDK / Flash.
>
> Correct me if I am wrong, but an upload of large files (2 GB or more) is
> currently not possible in Flash. And maybe we can check if it is possible
> to enable a larger file upload / download via Flex / Flash. This feature is
> very useful for Enterprise RIA's. I have already developed such an app and
> have the same problem.
>
> Thanks!
>
> Marcus
>
> Am 28.03.2012 um 16:55 schrieb Avinash Narayanan:
>
> > Hi JP,
> >
> > Thanks for taking time to reply! Stackoverflow had questions like this
> but
> > not satisfactory answers. This was my last ditch effort since the other
> > option is to write my own SFTP plug (which clients wont pay me to do :|).
> >
> > As for the apps, this upload needs to be 'part' of a desktop application
> > written in adobe air so can't use any of these other tools :(
> >
> > Thanks
> > Avinash Y
> >
> >
> > On Wed, Mar 28, 2012 at 6:54 PM, JP Bader <jp@zavteq.com> wrote:
> >
> >> Hi Avinash,
> >>
> >> My quick take on this is why you would want to recreate a tool for
> >> this?  Aren't there plenty of free SFTP apps already?  Why not take
> >> advantage of one of them? Tortoise, Cute, WinSCP, FileZilla, etc.
> >>
> >> Also, questions like these might be better asked on other forums like
> >> stack overflow.  This mailing list is for questions and development
> >> regarding the next release of Flex.
> >>
> >> Regards,
> >>
> >> JP
> >>
> >> On Wed, Mar 28, 2012 at 3:16 AM, Avinash Narayanan
> >> <avinashapr9@gmail.com> wrote:
> >>> Hi All,
> >>>
> >>> I know this community is meant for future development of Apache Flex
> but
> >>> I'm a little lost here. I need to upload ~2Gb file from my local
> machine
> >> to
> >>> a url via an air app using sftp. problem is we don't have sftp lib
> >>> available.
> >>>
> >>> Also, I'm confused as to why in forums it says the flash player needs
> to
> >>> take the entire file into memory before loading it but I don't see any
> >>> memory increase in my task manager (using the fileReference class).
> >>>
> >>> Another thing I wanted to know is how best to split up the file into
> >> chunks
> >>> for multi-part loading? Any help in any of these areas will be
> supremely
> >>> helpful!
> >>>
> >>> I've already seen the following links
> >>>
> >>> http://www.actionscript.org/forums/showthread.php3?t=181895
> >>> http://forums.adobe.com/thread/631103
> >>> http://blog.ansuz.nl/index.php/2011/02/11/flex-ftp-abort/
> >>> http://maliboo.pl/projects/FlexFTP/
> >>> http://forums.adobe.com/thread/245294
> >>>
> >>
> http://blog.flexexamples.com/2007/09/21/uploading-files-in-flex-using-the-filereference-class/
> >>>
> >>> Thanks in Advance.
> >>>
> >>>
> >>> With Warm Regards,
> >>> Avinash
> >>
> >>
> >>
> >> --
> >> JP Bader
> >> Principal
> >> Zavteq, Inc.
> >> @lordB8r | jp@zavteq.com
> >> 608.692.2468
> >>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message