Question: Saving plot to jpeg file using Maplet

I would like to save a simple plot to jpeg file on my hard disk. I've got a Maplet, and a Button which looks like that

Button['SIM']
 (
     "Save image",
     onclick=Evaluate('function'='saveImage()')
)

and a procedure:

saveImage := proc()

   plotsetup('jpeg', 'plotoutput'="plot.jpeg", 'plotoptions'="portrait,noborder");
   plot3d(sin(x)+cos(y), x=0..2*Pi, y=0..2*Pi, 'axes'='boxed');

 end proc:

The problem is that no plot.jpeg file is created... I tried to execute the same two commands (plotsetup and plot3d) outside of my program and it works just fine. Procedure saveImage gets called everytime I press the button because I checked it out by printing some string in this procedure. What's the problem ?

Please Wait...