We had something like in the following snippet:
uploadField.add(new AjaxEventBehavior("onchange") { protected void onEvent(AjaxRequestTarget target) { Request request = RequestCycle.get().getRequest(); String filename = request.getParameter("filename"); String text = getModel().getObject().getName(); if ((text == null) || "".equals(text.trim())) { int index = filename.lastIndexOf("."); if (index > 0) { filename = filename.substring(0, index); } getModel().getObject().setName(filename); } target.addComponent(name); } public CharSequence getCallbackUrl(boolean onlyTargetActivePage) { CharSequence callBackUrl = super.getCallbackUrl(onlyTargetActivePage); return callBackUrl + "&filename=' + this.value + '"; } });Starting from IE8 and also in Chrome, but not yet in Firefox, according to the specifications of HTML5, a file upload control should not reveal the real local path to the file you have selected, if you manipulate its value string with JavaScript. Instead, the string that is returned by the script, which handles the file information is c:\fakepath.
So, we have to give up using this functionality.
No comments:
Post a Comment