FTP an image from iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hoburne
Posts: 40
Joined: Tue Oct 04, 2011 11:13 am

FTP an image from iOS

Post by hoburne » Wed Apr 24, 2013 1:18 pm

Hi all,

I have looked through the forums and dictionary and thought I had what I was looking for, however, I still need some pointers or clarification.

I am writing an iOS app (which is driving me crazy!!) which simply takes a picture with the camera, displays to the screen then at the press of a button FTP uploads the image to our FTP storage online. Really simple on paper but I am getting stuck at the FTP part. Could you point me in the direction of an example or a paper I could read about this?

I can't see the wood for the trees on this one! Maybe all I need is sleep and a clear head tomorrow but any advice or pointers would be appreciated.

Thanks in advance!

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: FTP an image from iOS

Post by LCNeil » Wed Apr 24, 2013 4:42 pm

Dear hoburne,

Thank you for your request.

The following script should be able to help you out with both taking a picture and then uploading it to a specified FTP-

Code: Select all

on mouseUp
--this just makes sure the pic is of a reasonable size to work with
   set the width of the templateImage to 250 
   set the height of the templateImage to 250
   set the lockLoc of the templateImage to true
--take the picture
   mobilepickphoto "camera"
--upload to FTP
   put the last image into url ("ftp://username:password@host/newimage.jpg")
--Informs of successful or unsuccessful upload
   if the result is not empty then
      answer "url put failed:" && the result
   else
      answer "success!"
   end if
end mouseUp
Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
--

hoburne
Posts: 40
Joined: Tue Oct 04, 2011 11:13 am

Re: FTP an image from iOS

Post by hoburne » Thu Apr 25, 2013 6:32 am

Morning!

So a good night's sleep and I have a clear head and thanks to Neil, a working app. Thanks Neil.

Interestingly, I used the "the last image" part of your put command in place of the image name I had assigned and it now works.

Thanks again.

:)

Nana
Posts: 38
Joined: Sat Aug 11, 2012 8:01 pm

Re: FTP an image from iOS

Post by Nana » Tue Nov 26, 2013 3:47 pm

Hi everybody,

I am trying to use Neil's script above in order to upload an image from my ios device to a server via ftp.

I tested the script on ios 6.1.3 and ios 7.0.4 on real devices and i get the following error

url put failed: The operation couldn't be complete. (kCFErrorDomainCFNework error 200.)

Does anyone has any idea how to solve it?

Thanking you in advance.

Post Reply