[EP-tech] Messages do not work in UploadMethod - action_add_format (Error)

rchilliard at mun.ca rchilliard at mun.ca
Thu Jun 21 19:17:27 BST 2012


Hi All,

   In the process of attempting to build a hook for on-demand virus scanning of uploaded files, I've been tinkering with action_add_format within UploadMethod.pm as it seems the most relevant location to hook in. In the case of a bad file, I want to toss the uploaded file and display an error message, comparable to that which would show up for a file transfer that otherwise fails: as an example, the existing "file didn't show up" handling code:

--- snip ---
if( !EPrints::Utils::is_set( $filename ) || !defined $fh )
        {
                $processor->{notes}->{upload} = {};
                $processor->add_message( "error", $self->{session}->html_phrase( "Plugin/InputForm/Component/Upload:upload_failed" ) );

                return 0;
        }
--- snip ---

In our case, this test would be replaced for an assessment of the virus scan results on the file, giving pass/fail.

In building this process, I think I've found a bit of a bug - the current upload configuration, using the ajax code to display the upload progress bar, seems to ignore any add_message() content from ever reaching the workflow page. No matter where in the subroutine an add_message call is placed; when it is called as a result of a file being uploaded via the form's File control, no message appears.

I've found this to be an issue on Firefox, IE and Chrome. Interestingly, on IE, the name of any file selected by the form control persists in the control after upload; if the "Upload" button is then clicked with the form in this state, add_message calls within action_add_format are respected, however the progress bar does not display.

As is, it seems the message feedback for any sort of upload trouble seems to be broken, can any others confirm?

Cheers,
Casey

________________________________
Casey Hilliard
PC Consultant,
Health Sciences Library / QE2 Systems,
Memorial University


This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20120621/3d534717/attachment.html 


More information about the Eprints-tech mailing list