Gracias monoswim,
 
Pero no me termina de resolver el problema, es lo que suponia, ahora no se puede colocar dos Content-type seguidos. Donde dices:  
 Cita:  primero guarda la imagen, has lo que deseas y luego imprime el HTML con el mensaje de confirmación, pero no imprimas el pjpeg al menos que vallas a mostrar SOLAMENTE el código de la imagen...en ese caso no iría el html...
    es casi lo mismo que quiero hacer y no necesito mostrar el codigo de la imagen. Para que se entienda, la rutina que uso es:  
 Cita:  sub reduce_foto {
# Reduce el tamaño de las fotos 
use GD;
my $foto = $_[0];
my $img_sub_path;
my $dir_im = $cod;
if($^O =~ /Win/i) {
	$img_sub_path = "/www.misitio.com/Imagenes/$dir_im/$foto";
	} else {
	$img_sub_path = "/Imagenes/$dir_im/$foto";
	}
my $Width = $_[1]; # ancho máximo permitido en pixeles
my $Height = $_[2]; # setear en 0 si quiere fotos de alto variable
$Cash_Dir	= "../Imagenes/$dir_im";	
my ($border_x, $border_y);
 
$img_path=$ENV{'DOCUMENT_ROOT'}.$img_sub_path;
$im = newFromJpeg GD::Image($img_path);
($width,$height) = $im->getBounds();
($new_width,$new_height) = newSize($width,$height,$Width,$Height);
$im2 = new GD::Image($new_width,$new_height);
$im2->copyResized($im,$border_x,$border_y,0,0,$new_widt  h,$new_height,$width,$height);
 
print "Content-type: image/pjpeg\n\n";
 
	$cashed_file_name=$img_sub_path;
	@mi_img = split('/',$cashed_file_name);
	$cashed_file_name = pop @mi_img;
	$cashed_file_name = &F_min($foto) if($_[3]);
	open(CASH,">".$Cash_Dir."/".$cashed_file_name);
	binmode(CASH);
	print CASH $im2->jpeg();
	close(CASH);
return $cashed_file_name if($_[3]);
}
    Y como veras es necesario colocar el Content-type: image/pjpeg si no, no se guarda. Acaso hay otra forma de guardar sin usar el image/pjpeg?? 
Gracias por ayudar. 
Luis