- From: Jonas Sicking <jonas@sicking.cc>
- Date: Mon, 11 Jul 2011 10:50:56 -0700
- To: Charles Pritchard <chuck@jumis.com>
- Cc: Adrian Bateman <adrianba@microsoft.com>, Anne van Kesteren <annevk@opera.com>, Julian Reschke <julian.reschke@gmx.de>, Alfonso Martínez de Lizarrondo <amla70@gmail.com>, Webapps WG <public-webapps@w3.org>
2011/7/11 Charles Pritchard <chuck@jumis.com>: > On 7/11/2011 10:12 AM, Adrian Bateman wrote: >> >> On 11 July 2011 10:02, Jonas Sicking wrote: >>> >>> Additionally, what is the use case of being able to set the filename >>> during a FormData submission? My perception was that the main use case >>> was to not get an empty filename as many serverside implementations of >>> multipart/form-data did not deal well with that. I so far have not >>> heard a reason to believe that having the ability to specify a precise >>> filename is a common use case, so it seems unnecessary to add syntax >>> sugar for that. >> >> Some content management systems use the original filename by default when >> storing files in document libraries. It's certainly a lesser use case but >> seems like a relatively trivial change to the API. I don't see it as sugar, >> since it's not possible to achieve this on the client in any other way. >> >> Adrian. > > The work around is a lot of work: using ArrayBuffer with XHR allows > arbitrary POSTS, > and so a multipart submissions can be built up from that. > > That's what we've had to do in the meantime. The suggested workaround is: var bb = new BlobBuilder; bb.append(theblob); myFormData.append("file", bb.getFile(name)); compared to myFormData.append("file", theblob, name); So no array buffers or manual encoding needed. Just two extra lines of code, one of which can be reused every time you need to do this. / Jonas
Received on Monday, 11 July 2011 17:51:53 UTC