Page 1 of 1

Cannot get image to upload to FTP on iOS

Posted: Thu Nov 26, 2015 12:29 pm
by Scoperzor
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.

Re: Cannot get image to upload to FTP on iOS

Posted: Thu Nov 26, 2015 12:47 pm
by Thierry
Hi,

Could it be connected with this one?

http://forums.livecode.com/viewtopic.ph ... 60#p134831

Re: Cannot get image to upload to FTP on iOS

Posted: Thu Nov 26, 2015 2:16 pm
by Scoperzor
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.