Hi Ehaze,
You know that's why Qdabra provides the functionality in qRules - because everyone wants to do this and it's a little tricky. After helping people for several years, we just put it into qRules so you don't even have to write code. There are numerous other benefits. Qdabra Software pays for this free forum and we lose money on it. One way you can support this forum is to install a free trial of qRules and if you like it you can buy it. Discounts are available if you give us a quote that we can use on our testimonials page. It's pretty cheap and will save you countless hours.
We no longer provide coding support for this question because a) we have done that many times and there are old threads on this site that have some examples, b) we have qRules available now, and c) people who want to support this site should donate through the purchase of one of these tools.
We do plan to revamp the site completely in the months ahead and your help now can make this happen.
Thanks for your understanding,
Here are a link to the qRules command documentation for SaveToSharePoint: http://www.infopathdev.com/files/folders/qrules/entry40104.aspx. If you search the site, you'll also find lots of posts.
Here's another link to the XTP that goes with it: http://www.infopathdev.com/blogs/mel_balsamo/archive/2010/01/11/qdabra-s-imagepicker-xtp.aspx