Arduino+Wifishield How to Transfer image

I'm working on a project where I need to transfer an image taken from an Adafriut TTL camera to my PC wirelessly using a wifi shield (with SD card). I was thinking about using a FTP server to do this but i'm having trouble getting the right code to connect the Wifi shield to the FTP server. I have found two sets of coding, but because I am new to this I can't figure out how to manipulate it to work in my benefit. Any input would be greatly appreciated.
The code below generates a HEX version of the image. I need to write that on to the server

#include <SoftwareSerial.h>
#include <SD.h>

byte incomingbyte;
SoftwareSerial mySerial(4,5);                     //Configure pin 4 and 5 as soft serial port
int a=0x0000,j=0,k=0,count=0,i=0,p=0;                    //Read Starting address       
uint8_t MH = 0x00,ML = 0x00;
boolean EndFlag=0,HeaderFlag=0;
int chipSelect = 4;
File logfile;
                               
void SendResetCmd();
void SetBaudRateCmd();
void SetImageSizeCmd();
void SendTakePhotoCmd();
void SendReadDataCmd();
void StopTakePhotoCmd();

void setup()
{ 
  Serial.begin(115200);
  mySerial.begin(115200);
  a-=0x20;
  pinMode(10, OUTPUT);
  
  //see if the card is present and can be initialized
  if (!SD.begin(chipSelect)) {
    Serial.print("Card failed, or not present");
    return;
  }
  Serial.println("card initialized.");

 // create a new file
  char filename[] = "Test1.jpg";
  for (uint8_t i = 0; i < 100; i++) {
    filename[6] = i/10 + '0';
    filename[7] = i%10 + '0';
    if (! SD.exists(filename)) {
      // only open a new file if it doesn't exist
      logfile = SD.open(filename, FILE_WRITE); 
      break;  // leave the loop!
    }
  }
  Serial.print("Logging to: ");
  Serial.println(filename);
}
  

void loop() 
{
     Serial.println("about to take picture...");
     
     byte a[32];
     p=0;
     SendResetCmd();
     delay(4000);                               //After reset, wait 2-3 second to send take picture command
      
     SendTakePhotoCmd();

     while(mySerial.available()>0)
      {
        incomingbyte=mySerial.read();
      }   
        
      while(!EndFlag)
      {  
         j=0;
         k=0;
         count=0;
         SendReadDataCmd();
         delay(20);
          while(mySerial.available()>0)
          {
               incomingbyte=mySerial.read();
               k++;
               if((k>5)&&(j<32)&&(!EndFlag))
               {
               a[j]=incomingbyte;
               if((a[j-1]==0xFF)&&(a[j]==0xD9))      //Check if the picture is over
               EndFlag=1;                           
               j++;
          count++;
               }
          }
         
          for(j=0;j<count;j++)
          {   if(a[j]<0x10)
              Serial.print("0");
              Serial.print(a[j], HEX);
              Serial.print(" ");
          }           //Send jpeg picture over the serial port
          
          if(((a[j-32]==0xFF)&&(a[j-31]==0xD8))||(p))
            {
            logfile.print((char*)a);
            Serial.println();
            p=1;
            
            }
      }
     logfile.close(); 
     Serial.print("Finished writing data to file");  
     while(1);    
}

//-----------------
//Camera functions

//Send Reset command
void SendResetCmd()
{
      mySerial.write(0x56);
      mySerial.write((byte)0x0);
      mySerial.write(0x26);
      mySerial.write((byte)0x0);
}

void SetImageSizeCmd()
{
      mySerial.write(0x56);
      mySerial.write((byte)0x0);
      mySerial.write(0x31);
      mySerial.write(0x05);
      mySerial.write(0x04);
      mySerial.write(0x01);
      mySerial.write((byte)0x0);
      mySerial.write(0x19);
      mySerial.write(0x22);
}

void SetBaudRateCmd()
{
      mySerial.write(0x56);
      mySerial.write((byte)0x0);
      mySerial.write(0x24);
      mySerial.write(0x03);
      mySerial.write(0x01);
      mySerial.write(0xAE);
      mySerial.write(0xC8);

}


//Send take picture command
void SendTakePhotoCmd()
{
      mySerial.write(0x56);
      mySerial.write((byte)0x0);
      mySerial.write(0x36);
      mySerial.write(0x01);
      mySerial.write((byte)0x0);  
}

//Read data
void SendReadDataCmd()
{
      MH=a/0x100;
      ML=a%0x100;
      mySerial.write(0x56);
      mySerial.write((byte)0x0);
      mySerial.write(0x32);
      mySerial.write(0x0c);
      mySerial.write((byte)0x0); 
      mySerial.write(0x0a);
      mySerial.write((byte)0x0);
      mySerial.write((byte)0x0);
      mySerial.write(MH);
      mySerial.write(ML);   
      mySerial.write((byte)0x0);
      mySerial.write((byte)0x0);
      mySerial.write((byte)0x0);
      mySerial.write(0x20);
      mySerial.write((byte)0x0);  
      mySerial.write(0x0a);
      a+=0x20;                            //address increases 32£¬set according to buffer size
}

void StopTakePhotoCmd()
{
      mySerial.write(0x56);
      mySerial.write((byte)0x0);
      mySerial.write(0x36);
      mySerial.write(0x01);
      mySerial.write(0x03);        
}

Also this is a code used for transfering data via ethernet shield. I am tring to manipulate it to work with the Wifi shield.

/*
   FTP passive client for IDE v1.0.1 and w5100/w5200
   Posted October 2012 by SurferTim
*/

#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
// comment out next line to write to SD from FTP server
#define FTPWRITE

// this must be unique
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x59, 0x67 };  

// change to your network settings
IPAddress ip( 192, 168, 2, 2 );    
IPAddress gateway( 192, 168, 2, 1 );
IPAddress subnet( 255, 255, 255, 0 );

// change to your server
IPAddress server( 1, 2, 3, 4 );

EthernetClient client;
EthernetClient dclient;

char outBuf[128];
char outCount;

// change fileName to your file (8.3 format!)
char fileName[13] = "test.txt";

void setup()
{
  Serial.begin(9600);

  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);

  if(SD.begin(4) == 0)
  {
    Serial.println(F("SD init fail"));          
  }

  Ethernet.begin(mac, ip, gateway, gateway, subnet); 
  digitalWrite(10,HIGH);
  delay(2000);
  Serial.println(F("Ready. Press f or r"));
}

void loop()
{
  byte inChar;

  inChar = Serial.read();

  if(inChar == 'f')
  {
    if(doFTP()) Serial.println(F("FTP OK"));
    else Serial.println(F("FTP FAIL"));
  }

  if(inChar == 'r')
  {
    readSD();    
  }

}

File fh;

byte doFTP()
{
#ifdef FTPWRITE
  fh = SD.open(fileName,FILE_READ);
#else
  SD.remove(fileName);
  fh = SD.open(fileName,FILE_WRITE);
#endif

  if(!fh)
  {
    Serial.println(F("SD open fail"));
    return 0;    
  }

#ifndef FTPWRITE  
  if(!fh.seek(0))
  {
    Serial.println(F("Rewind fail"));
    fh.close();
    return 0;    
  }
#endif

  Serial.println(F("SD opened"));

  if (client.connect(server,21)) {
    Serial.println(F("Command connected"));
  } 
  else {
    fh.close();
    Serial.println(F("Command connection failed"));
    return 0;
  }

  if(!eRcv()) return 0;

  client.println(F("USER myuser"));

  if(!eRcv()) return 0;

  client.println(F("PASS mypassword"));

  if(!eRcv()) return 0;

  client.println(F("SYST"));

  if(!eRcv()) return 0;

  client.println(F("PASV"));

  if(!eRcv()) return 0;

  char *tStr = strtok(outBuf,"(,");
  int array_pasv[6];
  for ( int i = 0; i < 6; i++) {
    tStr = strtok(NULL,"(,");
    array_pasv[i] = atoi(tStr);
    if(tStr == NULL)
    {
      Serial.println(F("Bad PASV Answer"));    

    }
  }

  unsigned int hiPort,loPort;

  hiPort = array_pasv[4] << 8;
  loPort = array_pasv[5] & 255;

  Serial.print(F("Data port: "));
  hiPort = hiPort | loPort;
  Serial.println(hiPort);

  if (dclient.connect(server,hiPort)) {
    Serial.println(F("Data connected"));
  } 
  else {
    Serial.println(F("Data connection failed"));
    client.stop();
    fh.close();
    return 0;
  }

#ifdef FTPWRITE 
  client.print(F("STOR "));
  client.println(fileName);
#else
  client.print(F("RETR "));
  client.println(fileName);
#endif

  if(!eRcv())
  {
    dclient.stop();
    return 0;
  }

#ifdef FTPWRITE
  Serial.println(F("Writing"));

  byte clientBuf[64];
  int clientCount = 0;

  while(fh.available())
  {
    clientBuf[clientCount] = fh.read();
    clientCount++;

    if(clientCount > 63)
    {
      dclient.write(clientBuf,64);
      clientCount = 0;
    }
  }

  if(clientCount > 0) dclient.write(clientBuf,clientCount);

#else
  while(dclient.connected())
  {
    while(dclient.available())
    {
      char c = dclient.read();
      fh.write(c);      
      Serial.write(c); 
    }
  }
#endif

  dclient.stop();
  Serial.println(F("Data disconnected"));

  if(!eRcv()) return 0;

  client.println(F("QUIT"));

  if(!eRcv()) return 0;

  client.stop();
  Serial.println(F("Command disconnected"));

  fh.close();
  Serial.println(F("SD closed"));
  return 1;
}

byte eRcv()
{
  byte respCode;
  byte thisByte;

  while(!client.available()) delay(1);

  respCode = client.peek();

  outCount = 0;

  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);

    if(outCount < 127)
    {
      outBuf[outCount] = thisByte;
      outCount++;      
      outBuf[outCount] = 0;
    }
  }

  if(respCode >= '4')
  {
    efail();
    return 0;  
  }

  return 1;
}


void efail()
{
  byte thisByte = 0;

  client.println(F("QUIT"));

  while(!client.available()) delay(1);

  while(client.available())
  {  
    thisByte = client.read();    
    Serial.write(thisByte);
  }

  client.stop();
  Serial.println(F("Command disconnected"));
  fh.close();
  Serial.println(F("SD closed"));
}

void readSD()
{
  fh = SD.open(fileName,FILE_READ);

  if(!fh)
  {
    Serial.println(F("SD open fail"));
    return;    
  }

  while(fh.available())
  {
    Serial.write(fh.read());
  }

  fh.close();
}