From: Joe W. <jo...@gm...> - 2012-07-30 23:08:33
|
Hi all, I've been working on adapting the JQuery File Upload Demo [1] to eXist-db. I believe that Wolfgang used this library for the file upload widget in eXide, but my aim is to create a general EXPath Repo package (.xar file) [2] containing the original demo simply adapted to eXist-db with the fewest changes necessary to produce the same results as the original demo. (The original demo provides sample server side code for PHP, nodejs, This package could be useful to anyone who needs to implement their own file uploader widget. Unfortunately, my version suffers from the following problems so far: 1. Drag and drop into the browser window fails, even though it works just fine with the original online demo [1]. In my version, the browser treats the drag and drop action as either "open this file in the browser window" or "download this file". I would expect the browser to add the dragged-in file to the list of files to upload, as in the original online demo. 2. Clicking on Add Files brings up the file chooser, but when I click on Upload file, I get this error: { "name": null, "error": "exerr:ERROR err:XPTY0004: checking function parameter 1 in call xmldb:encode-uri(untyped-value-check[xs:string, $name]): XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: xmldb:encode-uri($string as xs:string) xs:anyURI. Expected cardinality: exactly one, got 0. [at line 70, column 72, source: /db/jQuery-File-Upload/server/xq/upload.xql]\nIn function:\n\tupload:upload(item()*, item()*, item()*) [70:9:/db/jQuery-File-Upload/server/xq/upload.xql]" } This error suggests that the upload.xql handler isn't receiving the "file[]" parameter from the upload form. Needless to say, the uploader completely fails to upload! :( I've attached the .xar file with the demo as it currently stands, and so my hope is that if you're interested in taking a look at this problem, you can install the .xar file and try troubleshooting or debugging. I'm using a recent version of trunk: eXist-db 2.1dev rev. 16847, on Chrome v20, on Win XP. By the way, the changes I made to the original demo distribution are as follows: 0. Included original distribution's index.html file and cors, css, img, js, and server directories with identical structure 1. Updated index.html to be a valid XML file, closing <br> tags, etc. 2. Created an upload handler in server/xq/upload.xql, modeled on eXide's modules/upload.xql 3. Created a controller.xql and modules/view.xql to apply correct serialization to index.html, modeled on eXide here too 4. Created EXPath repo files Can anyone suggest how I can overcome the problems I noted above? Many thanks, Joe [1] http://blueimp.github.com/jQuery-File-Upload/ [2] http://exist-db.org/exist/repo/repo.xml |