From 6585ff14e671a6a0a5d34daaa519abc4149fac19 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 8 Sep 2011 20:32:58 +0000 Subject: [PATCH] Add a place for egroupware to tap into file request before it's sent --- phpgwapi/js/jquery/jquery.html5_upload.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpgwapi/js/jquery/jquery.html5_upload.js b/phpgwapi/js/jquery/jquery.html5_upload.js index a648c7ba93..570961503b 100644 --- a/phpgwapi/js/jquery/jquery.html5_upload.js +++ b/phpgwapi/js/jquery/jquery.html5_upload.js @@ -141,6 +141,7 @@ if (window.FormData) {//Many thanks to scottt.tw var f = new FormData(); f.append(typeof(options.fieldName) == "function" ? options.fieldName() : options.fieldName, file); + if(typeof(options.beforeSend) == "function") { options.beforeSend(f);} // Give eGW a chance to interfere xhr.send(f); } else if (file.getAsBinary) {//Thanks to jm.schelcher @@ -171,6 +172,16 @@ builder += file.getAsBinary(); builder += crlf; + // Give eGW a chance to interfere + if(typeof(options.beforeSend) == "function") { + builder += dashdash; + builder += boundary; + builder += crlf; + + builder+=options.beforeSend(); + builder += crlf; + } + /* Write boundary. */ builder += dashdash; builder += boundary;