in reply to Re^6: file upload and IO::Handle
in thread file upload and IO::Handle

oops, I see what you said now, about the session and if they open a new browser window, did not read that line careful enough... I can fix that by not allowing another upload to start until the first is done.
There will only be a few people that are allowed access to this, so I don't think they will need to use it to often. They are just uploading videos for product reviews, more then often they will be no more than 10MB, and he is on a super fast high speed connection so the upload should be fast enough for him to finish it before needing another.
Using the code I changed it to, if I can get it to work, I can see if the _uploadStatus_ in the session exists if so, not build another form, and tell them to please wait until the other upload is completed, and then keep auto-refreshing that form with ajax until it is done so then it will rebuild the form so they can upload another.

still need answered my other questions though, please, as I still cannot figure out hook, the values passed to it(or jus, received (why not passed, or where passed from?)) and what executes it.

Rich

Replies are listed 'Best First'.
Re^8: file upload and IO::Handle
by rowdog (Curate) on Sep 09, 2010 at 19:42 UTC
    I still cannot figure out hook, the values passed to it(or jus, received (why not passed, or where passed from?)) and what executes it.

    Well, CGI explains all that in Progress bars for file uploads and avoiding_temp files but what happens is, CGI has a socket for the upload, every time it reads a chunk from the socket, it calls the hook with the new data, which is where your parameters are coming from.

      Ok, I followed the CGI recommendation for setting it:
      $q = CGI->new(\&hook [,$sess_ref [,$use_tempfile]]);
      and I get this error:
      syntax error at /home/path/to/Files/file_upload_sys.data line 5, near +"&hook ["
      which is the line I showed you above...
      why does that not work? $sess_ref is the session reference to variable to use the session stuff, the CGI documetion says $data is optional and can be the database handle, so I figured I may as well pass the session reference so it can use the session they are in, to update the status. but the error happens.

      Also, inside of the hook, I have it open a temp file and write data to it, always appending it so that I can confirm it is reaching inside the hook, but nothing ever gets written and no die error is executed so I know it is just not getting executed. How could that be?

      Thanks again,
      Rich

        Get rid of the [

        $q = CGI->new(\&hook [,$sess_ref [,$use_tempfile]]);

        That's the example from CGI showing the optional syntax. What it means is that you can use it like

        $q CGI->new(\&hook);
        or
        $q = CGI->new(\&hook, $sess_ref);
        or
        $q = CGI->new(\&hook, $sess_ref, $use_tempfile);

        Once you get that squared away, you should see hook getting called.