I'll try to be as little biased as I can: you can embed an ajax call in 
your response page that points to a "hidden" page that does all the work of 
resizing/uploading/updatingthedb. Basically the users uploads the large 
image, you redirect him to "Thanks for posting" page, in that page there is 
an Ajax call to "myprohibitedfunction" - better if protected with 
auth_signature - that takes a parameter of the uploaded image and does all 
the work.

Assuming that you can spare a process/thread for this "hidden" call, the 
real problem is that if the function - myprohibitedfunction - takes a long 
time, the webserver can "see" it as a blocked thread/process and terminate 
it abruptly. That's the main reason behind the existence of all various 
tasks schedulers (and cron scripts). 

Il giorno venerdì 31 agosto 2012 18:24:10 UTC+2, Yarin ha scritto:
>
> I have an app where the user uploads a large photo using web2py's normal 
> upload mechanism. After that, the program needs to do some image 
> manipulation, upload it to cloudfiles, and update the db when it's 
> complete. But I don't want to require the user to wait around for all that 
> to finish before receiving a response. 
>
> What are the options for getting a response back when the initial upload 
> completes, yet at the same time kicking off an async process that finishes 
> the job of processing the image on the server side?
>
> (I could use the scheduler, but I'm wondering if there's a more basic 
> approach for this type of case)
>

-- 



Reply via email to