[Kss-devel] File upload when submitting a form via kss.

Hedley Roos hedley at upfrontsystems.co.za
Mon Nov 12 09:25:12 CET 2007


>> Is there anything that I can do to ensure that the form is marshaled in
>> such a way that I can get a FileUpload object instead of a string?
> 
> No. There is no way to access the content of a file from javascript. The 
> browsers make this sure for security reasons: so that malicious web code 
> could not gain access to the filesystem content.
> 
> There could be some tricky way to get around this, but we did not 
> experiment with it yet.
> 

How about some asynchronous approach?

Put the <input type="file"/> in its own <form>. This form submits to 
action="store_file_in_temporary_place"

Then in a Python Script invoked by kss call a custom command to submit 
that form which contains the file input (ie 
store_file_in_temporary_place will eventually fire). Your Python Script 
will wait for the upload to complete, and can then pick up that file 
wherever store_file_in_temporary_place stored it.

Two catches though:
1. You'll have to increase the kss timeout of your Script (it calls a 
script which will presumably take a while to complete).
2. You'll have to write your own kss plugin to submit the form with the 
file input.

But since you actually know me JC we can have a look at it :)

Hedley


More information about the Kss-devel mailing list