Upload component doesn't invoke Upload.Receiver#receiveUpload

I have class UploadReceiver which implements Upload.Receiver and I’ve implemented receiveUpload-method but it gets never called when I press “send” button of Upload-component.

Here is example how I use it:


UploadReceiver uploadReceiver = new UploadReceiver();
Upload uploadComponent = new Upload("File upload", uploadReceiver);
uploadComponent.addListener(this); //Upload.FinishedListener

And my UploadReceiver:


public class UploadReceiver implements Upload.Receiver{
    FileOutputStream fileOutput = null;
    private String fileName;
    private String mimeType;
    private String actualFilename;
    
    /** Creates a new instance of UploadReceiver */
    public UploadReceiver() {
    }
    
    public OutputStream receiveUpload(String filename, String MIMEType) {
        String attachmentDir = Conf.getAttachmentDir();
        actualFilename = attachmentDir + File.separator + filename;
        fileName = filename;
        mimeType = MIMEType;
        try {
            fileOutput = new FileOutputStream(actualFilename, false);
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        }
        return fileOutput;
    }

Hi!

I guess you are using it in brand new “Div window” ? There is a bug in it which is already fixed in our internal SVN. Window ordering function didn’t return to submitting form.

Bug fix release will be released in coming weeks. If you are in a real hurry with it, drop me a line (matti ät itmill dot com), so I can send you an unofficial build.

hi…
I also used this receiveUpload method to upload an image.
but couldn’t save that uploaded image into directory because i cnt find this “Conf” object
[String attachmentDir = Conf.getAttachmentDir();]

So i cant get the directory of uploaded image

please help me…:frowning: