<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi All,<br>
<br>
&nbsp;&nbsp; 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 &quot;file didn't show up&quot; handling code:<br>
&nbsp;<br>
--- snip ---<br>
if( !EPrints::Utils::is_set( $filename ) || !defined $fh )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $processor-&gt;{notes}-&gt;{upload} = {};<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $processor-&gt;add_message( &quot;error&quot;, $self-&gt;{session}-&gt;html_phrase( &quot;Plugin/InputForm/Component/Upload:upload_failed&quot; ) );<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
--- snip ---<br>
<br>
In our case, this test would be replaced for an assessment of the virus scan results on the file, giving pass/fail.<br>
<br>
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.
<br>
<br>
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 &quot;Upload&quot; 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.<br>
<br>
As is, it seems the message feedback for any sort of upload trouble seems to be broken, can any others confirm?<br>
<br>
Cheers,<br>
Casey<br>
<div><br>
<div style="font-family:Tahoma; font-size:13px"><font size="2"><span style="font-family:Tahoma"></span></font>
<hr style="width:100%; height:2px">
<font size="2"><span style="font-family:Tahoma">Casey Hilliard</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma">PC Consultant,</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma">Health Sciences Library / QE2 Systems,</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma">Memorial University</span><br style="font-family:Tahoma">
<span style="font-family:Tahoma"></span><span style="font-family:Tahoma"><br>
</span></font></div>
</div>
</div>
<br>This electronic communication is governed by the terms and conditions at http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php
</body>
</html>