View Full Version : Uploading files programatically

4 Apr 2011, 4:44 PM
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:

<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"/>

... but have Ext create the file contents and post it instead. Something like this, I assume:

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')?

Any help would be appreciated.

5 Apr 2011, 8:54 AM
Not sure you are going to be able to do the upload but instead send things as a POST. Not sure if there is a limit to the amount you can send tho