RTC Forums

Subscription => Support => Topic started by: Dany on September 04, 2014, 12:55:27 PM



Title: Multiple file uploads (using multipart/form-data)
Post by: Dany on September 04, 2014, 12:55:27 PM
Hello!

I put an input element of type file on my form and add the multiple property to the element. As the request is processed i can count the number of files using ItemCount and access the filenames using ItemValue (i think). But i cannot find a GetFile function taking an integer index parameter so i do not know how to write the individual files to disk/stream (i'd like to process them one at a time). Browsers seem to name the multiple elements the same so using GetFile('file', 'Name1') does not seem to do it. Also Element['file', 0] returns a string.

TIA,

/Dany


Title: Re: Multiple file uploads (using multipart/form-data)
Post by: D.Tkalcec (RTC) on September 04, 2014, 06:11:23 PM
OK. Download the latest RTC SDK update (v6.38).

Now, multiple file uploads using the "multiple" attribute are also supported and the "QuickStart/BrowserUpload" example is updated to demonstrate how to use this new feature.

In short, you can now check how many files were uploaded by using the "ElementCount" property, access all file names through the "Element" property and permanently store files using the "GetFile" method, which has a new "FileIndex" parameter to speficy which file you want to access (index starting at 0).

Best Regards,
Danijel Tkalcec


Title: Re: Multiple file uploads (using multipart/form-data)
Post by: Dany on September 04, 2014, 06:18:17 PM
WOW Danijel!

I'll check it out tomorrow and during the weekend. This was really really nicely done of you.

You see, i'm very reclusive against parsing manually. And even though i just found out i could use the HTML5 FormData object to transfer from the input object to file-entries in a new the multipart with varying names the "API" that my server exposes will not be 100% cool for others who want to communicate with it.

Thanks a BUNCH!

Regards,

/Dany