Cannot get image to upload to FTP on iOS

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

Cannot get image to upload to FTP on iOS

Post by Scoperzor » Thu Nov 26, 2015 12:29 pm

After struggling for countless hours with this, having read all the documentation/forum posts online about similar topics and issues, I'm coming here in the hope of getting an answer.

Platform is iOS. I've created a new stack to reduce unknowns, with the single button which is meant to do the following:
1) Capture image using rear camera - works
2) Export this image to file - works

Code: Select all

           put specialFolderPath("documents") & "/new_large.png" into tFile1
            export the last img to file tFile1 as PNG
3) Set up FTP details - taken out specifics in this example

Code: Select all

put "x" into sUsername
   put "x" into sPassword
   put "0.0.0.0/x/x" into sHost
   put "78" & "_large" into sName
   
   put urlEncode(sUsername) into sUsername
   put urlEncode(sPassword) into sPassword
   put urlEncode(sHost) into sHost
   put urlEncode(sName) into sName
4) Rename the image - works

Code: Select all

put specialFolderPath("documents") & "/new_large.png" into tFile1
   put specialFolderPath("documents") & "/"&sName&".png" into tFile2
   if there is a file tFile1 then
      rename tFile1 to tFile2
5) Upload the new file - does not work

Code: Select all

put "ftp://"&sUsername&":"&sPassword&"@"&sHost & slash &sName &".png" into urlName
      
      put url ("binfile:" & tFile2) into tExport
      put tExport into url (urlName)
      if the result is not empty then
         answer "URL put failed: " & the result
      else
         answer "Success!"
      end if
The answer of the result is: "The operation couldn't be completed. (kCFErrorDomainCFNetwork error 2.)

Any idea? I've used the exact same script on the desktop version of Livecode and it renames and uploads the file correctly to the FTP.

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Cannot get image to upload to FTP on iOS

Post by Thierry » Thu Nov 26, 2015 12:47 pm

Hi,

Could it be connected with this one?

http://forums.livecode.com/viewtopic.ph ... 60#p134831
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

Re: Cannot get image to upload to FTP on iOS

Post by Scoperzor » Thu Nov 26, 2015 2:16 pm

Thierry wrote:Hi,

Could it be connected with this one?

http://forums.livecode.com/viewtopic.ph ... 60#p134831
I'm not sure, I guess I would have to try a newer version of LC to see? I'm on 7.0.6.

But it's strange because I have 3 other apps with the exact same code, all uploading to non-secure servers, and this is the only one I can't get to work.

Post Reply