I do that, that way if someone refreshes the page, you can have page load checks that pick up from whatever the state is in the session variable.

Oh, and I forgot to mention using CFAJAXPROXY and setSyncMode() and setAsyncMode().

setSyncMode() locks the javascript routine until a response from the server is received.
setAsyncMode() will call a function when the server returns a message.

I also should ask, is the client expecting something back in this process? If not, then why hold the client up? The server will run through it's scripts even if the person closes the browser.




On 6/9/2014 11:02 AM, Jason King wrote:
I'm intrigued about the first concept.

So, I could post the image to a server.cfc, and as it goes through various steps internally within the server.cfc process, it updates a session.variable to reflect the current status.

I could call this session.imageUploadStatus

Then run a loop, say at 1second intervals, that only runs WHILE the initial JSON request to server.cfc is awaiting response to say it's completed. And the loop just looks for changes in the session.imageUploadStatus?

Does that seem reasonable?


On Mon, Jun 9, 2014 at 12:18 AM, Ernest McCloskey <[email protected] <mailto:[email protected]>> wrote:

    Keep in mind that HTML is a stateless protocol.  So you need to
    find ways around it.  There are 2 ways I use currently,

    1st is to use session variables that the server updates as it goes
    thru the process and the client does ajax calls at set intervals
    checking the session variables (or maybe a database table) for
    status updates.

    2nd method I use is right here:
    
http://www.bennadel.com/blog/1244-coldfusion-jquery-and-ajax-file-upload-demo.htm

    I use that to upload photos and when the system is done processing
    them it tells the client to move to the next step.




    On 6/8/2014 11:02 PM, Jason Allen wrote:
    Hey Guys!

    I have a real world design issue I'm starting to get stuck on.

    I want users to be able to upload images.

    When the image is uploaded, I'm going to run it against some
    imagemagick functions to create thumbnails, and some alternate
    sizes.

    Along with the resizing.

    As it is right now, I send an ajax/json request to a remote cfc,
    and get a response saying that it's been completed successfully
    or there's an error. What I'd like to do is have the client
    updated as various steps in the process are completed.

    I could breakup the client request into several steps, but I need
    to make sure this is a complete process in total. If I let the
    client initiate each step after getting notice that the current
    process completed, the total process could fail much more easily.
    Once the server gets the file, it can do everything about without
    any further client input. The first few steps are pretty quick
    AND the client can pretty much move on once they are done. But
    the last step might take awhile.

    So I'm thinking I can just make a template for file uploads in
    general.



    1. Client sends request to imageUpload.cfc with file and file
    details posted to the request.

    2. Server processes file, modifies details (name, extension) if
    necessary, saves to disk, creates database entry, and pushes
    update to client.

    3. Server beings processing of subroutines. Image resizing, virus
    checks, etc. As each routine finishes, server pushes update to
    client.

    4. Upon total completely of process, server pushes update to
    client saying entire process is completed. This could allow user
    to move onto doing different things, and get an alert saying the
    file upload/processing has completed.


    Best way to do this? I'm seeing some hack ways to use javascript
    to keep open http requests and you just flush data out to it. But
    apparently it's really just a hack and isn't dependable across
    all browsers.


    Here's what I'm thinking, and I'm leaning towards B as being the
    most reliable way to utilize standard ajax functionality.

    a) Send each individual request one at a time to keep the
    requests simple post/respose? I don't like this because it
    requires the client to initiate each process creating an
    unnecessary dependancy on the client to complete the full process.

    b) Create a temp file or database record that is updated as the
    server finishes processes. The client can query this for updates
    at a set frequency. When completed, delete record/file.


    Thoughts? If I could keep an open connection with the client,
    that'd be awesome, cause I could then just push updates.
-- -- online documentation: http://openbd.org/manual/
    http://groups.google.com/group/openbd?hl=en

    ---
    You received this message because you are subscribed to the
    Google Groups "Open BlueDragon" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    For more options, visit https://groups.google.com/d/optout.

-- -- online documentation: http://openbd.org/manual/
    http://groups.google.com/group/openbd?hl=en

    ---
    You received this message because you are subscribed to the Google
    Groups "Open BlueDragon" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    For more options, visit https://groups.google.com/d/optout.


--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

---
You received this message because you are subscribed to the Google Groups "Open BlueDragon" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

--- You received this message because you are subscribed to the Google Groups "Open BlueDragon" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to