reiern70 commented on a change in pull request #466:
URL: https://github.com/apache/wicket/pull/466#discussion_r609562730



##########
File path: 
wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUploadField.java
##########
@@ -47,6 +56,73 @@
 {
        private static final long serialVersionUID = 1L;
 
+       /**
+        *  {@link org.apache.wicket.ajax.form.OnChangeAjaxBehavior} that 
streams back to server properties
+        *  of the selected file (at client side), even when file has not yet 
being uploaded.
+s       *
+        * @author Ernesto Reinaldo Barreiro (reier...@gmail.com).
+        */
+       public static abstract class OnFileSelectedBehavior extends 
OnChangeAjaxBehavior
+       {
+               private static final long serialVersionUID = 1L;
+
+               @Override
+               protected void onBind() {
+                       super.onBind();
+                       Component component = getComponent();
+                       if (!(component instanceof FileUploadField))
+                       {
+                               throw new WicketRuntimeException("Behavior " + 
getClass().getName()
+                                               + " can only be added to an 
instance of a FileUploadField");
+                       }
+               }
+
+               @Override
+               protected void onUpdate(AjaxRequestTarget target)
+               {
+                       Request request = RequestCycle.get().getRequest();
+                       String fileName = 
request.getRequestParameters().getParameterValue("fileName").toString();

Review comment:
       fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to