I'm hoping this isn't a FAQ. What I need to do is encode a data structure as JSON and send it to a server using POST as if it were an uploaded file. That is, I'd like take this kind of HTML fragment:

Code:
<form name="resourcepost"  method=post enctype="multipart/form-data" action="http://server/destpath">
<input type=file name="datafile" accept="application/json" size=120>
<input type="submit" value="Post"/>
</form>
... but have Ext create the file contents and post it instead. Something like this, I assume:

Code:
jsonContent=Ext.util.JSON.encode(structureToSend);
Ext.Ajax.request({
  url: postPath,
  method: 'POST'
})
But in this case, what do I do with jsonContent, and how would I specify the name of the uploaded file (fx. 'data.json')?