Github user andruhon commented on a diff in the pull request:

    https://github.com/apache/wicket/pull/256#discussion_r161936292
  
    --- Diff: 
wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxFileUploadBehavior.java
 ---
    @@ -0,0 +1,156 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.wicket.extensions.ajax.markup.html;
    +
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.commons.fileupload.FileItem;
    +import org.apache.commons.fileupload.FileUploadException;
    +import org.apache.wicket.Component;
    +import org.apache.wicket.ajax.AjaxEventBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
    +import org.apache.wicket.ajax.attributes.AjaxRequestAttributes.Method;
    +import org.apache.wicket.markup.head.IHeaderResponse;
    +import org.apache.wicket.markup.head.JavaScriptHeaderItem;
    +import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
    +import org.apache.wicket.markup.html.form.upload.FileUpload;
    +import org.apache.wicket.protocol.http.servlet.MultipartServletWebRequest;
    +import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
    +import org.apache.wicket.request.resource.PackageResourceReference;
    +import org.apache.wicket.request.resource.ResourceReference;
    +import org.apache.wicket.util.lang.Args;
    +import org.apache.wicket.util.lang.Bytes;
    +
    +/**
    + * Uploads files from a drop event.
    + * 
    + * @author svenmeier
    + */
    +public class AjaxFileUploadBehavior extends AjaxEventBehavior
    --- End diff --
    
    I think the name of this particular class should somehow point that this 
one handles drop event, because we might need to ajax upload with some other 
cause event (such as `change` of file select field). So most of functionality 
can go into some superclass, probably with `AjaxFileUploadBehavior` name and 
two subclasses this drag-n-drop one and another one for file input change.


---

Reply via email to