JPEG serial transfer from arduino to processing code help

I am working on a project which requires me to transfer .jpg from SD to computer through SPI using arduino. I found [SOLVED] thread on the same topic but the code that the person had provided does not seem to work when i use it. It looks as the arduino does send the file but i dont seem to be receiving it at the other end.

Here’s the code:
For arduino:

 #include <SD.h>   
  
 File photoFile;   
 const int buttonPin = 7;   
 const int ledPin = 5;   
   
   
 void setup(){   
   
  Serial.begin(115200);   
   
  pinMode(buttonPin,INPUT);   
  pinMode(ledPin,OUTPUT);   
   
  //Serial.println("initializing sd card");   
  pinMode(10,OUTPUT);     // CS pin of SD Card Shield   
   
  if (!SD.begin(10)) {   
   Serial.print("sd initialzation failed");   
   return;   
  }   
  //Serial.println("sd initialization done");   
 }   
   
   
 void loop(){   
   
  while(1){   
   // Serial.println("press the button to send picture");   
   Serial.flush();     
   
   while(digitalRead(buttonPin) == LOW);   
   if(digitalRead(buttonPin) == HIGH){   
    delay(50);   
   
    if(digitalRead(buttonPin) == HIGH){   
     delay(200);   
     File photoFile = SD.open("pic02.jpg");   
   
     if (photoFile) {   
      while (photoFile.position() < photoFile.size()) {   
   
       digitalWrite(ledPin,HIGH);              
       Serial.write(photoFile.read());   
      }   
   
      photoFile.close();   
      digitalWrite(ledPin,LOW);    
     }    
   
     else {   
      Serial.println("error sending photo");   
     }         
    }   
    //Serial.println("photo sent");    
   }   
  }   
 }

and for processing:

import processing.serial.*;  
   
 Serial myPort;  
 OutputStream output;  
   
   
 void setup() {  
   
  size(320, 240);  
   
  //println( Serial.list() );  
  myPort = new Serial( this, Serial.list()[0], 115200);  
  myPort.clear();  
   
  output = createOutput("pic02.jpg");  
 }  
   
   
 void draw() {  
   
  try {   
   while ( myPort.available () > 0 ) {  
    output.write(myPort.read());  
   }  
  }   
  catch (IOException e) {  
   e.printStackTrace();  
  }  
 }  
   
   
 void keyPressed() {  
   
  try {   
   output.flush(); // Writes the remaining data to the file  
   output.close(); // Finishes the file  
  }   
   
  catch (IOException e) {  
   e.printStackTrace();  
  }  
 }

the website is here: Dread-Eye: Arduino + Processing: JPEG Serial Transfer
He says it works but mmm not so sure. Since i am new to both formats i cant really check it.

Has anyone tried out this code? Is there another code that i could perhaps use. I have done exhaustive search but dont seem to nail this one down

The sender program does do its job: opens a file and dumps it to a serial port.

U have to get (write) the PC software to receive and store the arriving datastreem.
maybee there can be a hint here:
http://playground.arduino.cc/Main/InterfacingWithSoftware#.UwZdJWJ5McI
or
http://processing.org/

Thanks for checking it.
Yeah i managed to get it done, both codes work like a charm.

Thanks again
mukhe