Nope, the form works fine, it just never reaches the line:

System.out.println("2 - upload not null");

Or do you mean HTML validation errors? Thats fine as well:

<wicket:panel>
        <form wicket:id="form" class="profileForm">
        
                <p wicket:id="textSelectImage" class="small">Select an image</p>
        
                <p><input type="file" wicket:id="picture"/></p>
                                
                <p><input type="submit" wicket:id="submit" value="Upload" /></p>
                
        </form>
</wicket:panel>

This panel is shown by a jQuery slideToggle() after someone clicks on a button, but its a normal form submit. Even when the form is always visible, ie no Javascript to show it, same thing.


Any ideas?


Thanks



On 5 Nov 2008, at 18:33, Igor Vaynberg wrote:

are there validation errors?

-igor

On Wed, Nov 5, 2008 at 10:14 AM, Steve Swinsburg
<[EMAIL PROTECTED]> wrote:
Hi all,
I'm having an odd problem in uploading a file where the result of:
FileUpload upload = uploadField.getFileUpload();
is always null. I can't see what I've done wrong.

Here's part of my onSubmit method which works for textfields, but not
fileuploads. It's a normal fileupload by the way (so its not an AJAX issue):
public void onSubmit(){

if (uploadField != null) {
System.out.println("1 - uploadField not null");
FileUpload upload = uploadField.getFileUpload();
if(upload != null) {
System.out.println("2 - upload not null");
byte[] photoBytes = upload.getBytes();
}
}

}

where uploadField is defined in the class like so:

private FileUploadField uploadField;
and then added to the form:
uploadField = new FileUploadField("picture");
form.add(uploadField);

So the form works as expected for textfields but not fileuploads. Can anyone
spot any issues/give me pointers? The form is multipart encoded.


thanks.






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to