When i create a form like this:
<form method='POST' action='gate.py'>
<input type='file' />
</form>
1) How i cant catch the response from the server, on a script?
2) I can send in a async way a file?
Thanks in advance.
When i create a form like this:
<form method='POST' action='gate.py'>
<input type='file' />
</form>
1) How i cant catch the response from the server, on a script?
2) I can send in a async way a file?
Thanks in advance.
Take a look:
Ajax File Upload: http://www.webtoolkit.info/ajax-file-upload.html
JQuery Form Plugin: http://jquery.malsup.com/form/#getting-started
One option is to post your form to a hidden iframe:
<iframe id="hidden-frame" name="hidden-frame" src="" style="width:0; height:0; display: none;;"></iframe>
<form method="POST" action="gate.py" target="hidden-frame">
<input type="file" />
</form>
Then from your "gate.py" script return some JavaScript code according to the result of the upload:
<script type="text/javascript>
alert('Upload Successful');
</script>
You could also interact with the parent to update a <div>
with the response.
On the other hand, you could also consider using a third-party plugin like Uploadify.