I wrote:
[...] I'd like to perform a simple check that I can access the file (by returning the file size and a line-by-line echo) using a velocity script: {{velocity}} #if ($request.addFile == "true") {{info}}Request received to add file{{/info}} #set ($fileUpload = $xwiki.fileupload) #set ($newFileName = $fileUpload.getFileName("newfile")) #if (!$newFileName) {{warn}}Failed to find submitted file{{/warn}} #else Found file $newFileName to load #set ($discard = $fileUpload.loadFileList()) #set ($fileitem = $fileUpload.getFileItems().get(0))
It was this last line, which I'd lifted from the script in OfficeImporter, that was causing the bother. The index of the file I wanted was 1, not 0. Move along now, nothing to see...