Hi Nifras, If you want more control over file uploading (chunking, pause/resume, progress etc.) use a file upload plugin such as JQuery File Upload [1].
[1] https://github.com/blueimp/jQuery-File-Upload Thanks. On Sun, Sep 20, 2015 at 8:51 PM, Ruwan Abeykoon <[email protected]> wrote: > Hi Nifras, > >>We need to speed up the image kind of upload in faster manner. > I do not quite understand what is the slowness, perhaps you might have > seen some interesting behaviour. > > As for my understanding, the most efficient upload is the stream based > upload. Upload single large file as single stream > > - cost less processing, > - less bandwidth, > - less memory in both client and server, > - less negotiations in application layer. > > We can speedup upload time when it comes to uploading multiple > files simultaneously with different connections. Thus is something image > sharing sites do. > > If you thinking in line of download accelerators or torrents being faster, > I would not agree. They really consume far more bandwidth and cpu/memory > resources either in server side or client side. Just compare any of > the accelerator/torrent client with simple wget command. > > Cheers, > Ruwan > > On Sun, Sep 20, 2015 at 7:09 PM, NIFRAS ISMAIL <[email protected]> > wrote: > >> Hi Sajith, >> Yes, There are lots of issues behind the seen. So uploading image in >> binary and put in a folder is the good way up to now. But Still I am not >> satisfy that method. We need to speed up the image kind of upload in faster >> manner. >> >> I have some abstracts. >> why can't we split the images into small set of chunks and upload in >> parallel way? If there is a efficient machanism available to split the >> images into small chunks and join the server its very much useful for any >> size of image uploads. >> >> Thank you for the great dig on base64 encoding. >> >> Nifras Ismail >> >> Regards. >> *M. Nifras Ismail* >> [image: LinkedIn] <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b> >> >> >> >> On Fri, Sep 18, 2015 at 10:40 PM, Sajith Ariyarathna <[email protected]> >> wrote: >> >>> Hi Nifras, >>> >>> Uploading base64 encoded string rather than the binary file has some >>> disadvantages. >>> >>> - Encoding to base64 is not a light-weight task. Especially for >>> mobile devices it can be very painful. Also for large files, web browser >>> might freeze or even crash [1]. >>> - Usually base64 encoded string is larger than its binary file about >>> 33% [2] [3]. So uploading base64 encoded string consumes more bandwidth >>> than uploading the binary file. >>> - In the server-side, reading a file as a base64 encoded string >>> loads the whole file to the memory (RAM) once which is a bad practice. >>> But >>> if you upload a binary file, then you can get a file stream to that ( >>> uploadedFile.getStream()) and can read the file from that stream >>> safely. >>> - Web browsers are optimized to handle uploading large files, but >>> not base64 strings. >>> >>> >>> I also took the liberty to answer your StackOverflow question [4]. >>> >>> [1] >>> http://stackoverflow.com/questions/16761927/aw-snap-when-data-uri-is-too-large >>> [2] >>> http://stackoverflow.com/questions/16331215/can-i-make-image-upload-faster-using-base64-encoding-in-android >>> [3] >>> http://davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/ >>> [4] http://stackoverflow.com/a/32657419/1577286 >>> >>> Thanks. >>> >>> On Fri, Sep 18, 2015 at 7:37 PM, NIFRAS ISMAIL <[email protected]> >>> wrote: >>> >>>> Ya sajith, but in my assumption if we convert the image into base64 >>>> encoding and post as string is take some how efficient way for direct image >>>> upload rather than file upload. >>>> >>>> Does this make any seance? >>>> On Sep 18, 2015 10:40 AM, "Sajith Ariyarathna" <[email protected]> >>>> wrote: >>>> >>>>> Hi Nifras, >>>>> >>>>> You can get multiple uploaded-files inside your Jaggery code using >>>>> request.getAllFiles() function. e.g. >>>>> >>>>> var files = request.getAllFiles(); // returns <name, File> map >>>>> for(var name in files) { >>>>> >>>>> if(files.hasOwnProperty(name)) { >>>>> >>>>> var file = files[name]; >>>>> >>>>> // do something with file >>>>> >>>>> } >>>>> >>>>> } >>>>> >>>>> >>>>> Thanks. >>>>> >>>>> On Fri, Sep 18, 2015 at 7:08 AM, NIFRAS ISMAIL <[email protected] >>>>> > wrote: >>>>> >>>>>> Hi Sajith, >>>>>> Thank you for the guide. >>>>>> So we can add multiple files upload from this stream. >>>>>> >>>>>> Regards. >>>>>> *M. Nifras Ismail* >>>>>> [image: LinkedIn] >>>>>> <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b> >>>>>> >>>>>> >>>>>> >>>>>> On Fri, Sep 18, 2015 at 12:32 AM, Sajith Ariyarathna < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi Nifras, >>>>>>> >>>>>>> request.getFile("myFile") does not represent a physical file, >>>>>>> rather it represent a stream to the uploaded file. Hence you cannot >>>>>>> "move" >>>>>>> it using .move("...") function. If you want to save the uploaded >>>>>>> file, then use the following code snippet. >>>>>>> >>>>>>> var uploadedFile = request.getFile("myFile"); >>>>>>> var savedFile = new File("/path/to/save/location/" + >>>>>>> uploadedFile.getName()); >>>>>>> savedFile.open('w'); >>>>>>> savedFile.write(uploadedFile.getStream()); >>>>>>> savedFile.close(); >>>>>>> >>>>>>> >>>>>>> Thanks. >>>>>>> >>>>>>> On Thu, Sep 10, 2015 at 2:41 PM, NIFRAS ISMAIL < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Hi All, >>>>>>>> Do we upload images to the server directly using Jaggery JS? >>>>>>>> http://stackoverflow.com/a/32497617/2672566 >>>>>>>> >>>>>>>> Regards. >>>>>>>> *M. Nifras Ismail* >>>>>>>> [image: LinkedIn] >>>>>>>> <http://lk.linkedin.com/pub/nifras-ismail/54/343/94b> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Dev mailing list >>>>>>>> [email protected] >>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Sajith Ariyarathna >>>>>>> Software Engineer; WSO2, Inc.; http://wso2.com/ >>>>>>> mobile: +94 77 6602284, +94 71 3951048 >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Sajith Ariyarathna >>>>> Software Engineer; WSO2, Inc.; http://wso2.com/ >>>>> mobile: +94 77 6602284, +94 71 3951048 >>>>> >>>> >>> >>> >>> -- >>> Sajith Ariyarathna >>> Software Engineer; WSO2, Inc.; http://wso2.com/ >>> mobile: +94 77 6602284, +94 71 3951048 >>> >> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > > *Ruwan Abeykoon* > *Architect,* > *WSO2, Inc. http://wso2.com <http://wso2.com/> * > *lean.enterprise.middleware.* > > email: [email protected] > -- Sajith Ariyarathna Software Engineer; WSO2, Inc.; http://wso2.com/ mobile: +94 77 6602284, +94 71 3951048
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
