Page 1 of 1

mobilepickphoto file type and ftp

Posted: Mon Oct 08, 2012 3:50 am
by cusingerBUSCw5N
I want to ftp a photo taken on an andoid to an outside server.

Code: Select all

  if the environment = "mobile" then
set the name of the templateimage to "harry"
set the loc of the templateimage to 400,100 -- or wherever you want it

mobilePickPhoto "camera" ,400 , 400
if the result = "" then 
-- ok do something with image "harry" here
      set the width of image "harry" to 400
      set the height of image "harry" to 400
      set the top of image "harry" to 400
      set the left of image "harry" to 100
set the border  of image "harry" to  true
set the threeD of image "harry" to false
set the borderwidth of image "harry" to  1
set the locklocation of the templateImage to false
set vis of image "harry" to "true"

 constant FTPHOST = "xxxxxx"
   constant FTPUSER = "xxxxx"
   constant FTPPASS = "xxxxx"

export image "harry" to pictVariable as png

   put pictVariable into url ("ftp://" & FTPUSER & ":" & FTPPASS & "@" & FTPHOST&"/path_to_docs_file/docs/myvar.png" )

end if
end if
It doesn't work. I have succeeded in getting empty files - so the ftp part is OK. I tried it without using the export an image line - and it failed as well. I have tried put image (1) instead of put pictVariable - and it failed....

1) How do you take a picture and ftp it to a remote site?

2) If the picture is already saved in the android's photo gallery - how do you get the file name and ftp it?

Thank you.

Re: mobilepickphoto file type and ftp

Posted: Mon Oct 08, 2012 4:21 am
by cusingerBUSCw5N
I have succeeded in saving my photo on the android, using

export snapshot from image "harry" to file ("/sdcard/Pictures/foo1.png") as png

(I might change it to /sdcard/pictures/screenshots/foo1.png)....

Anyway...I still can't figure out how to ftp it directly, or get an existing image (in this case foo1.png) and ftp it.

Re: mobilepickphoto file type and ftp

Posted: Mon Oct 08, 2012 6:15 pm
by cusingerBUSCw5N
I have partially succeeded in ftp'ing from an android to a server with this code

Code: Select all

on mouseUp

      constant FTPHOST = "xxxxx"
   constant FTPUSER = "xxxx"
   constant FTPPASS = "xxxxx"   

 put ("/sdcard/Pictures/foo1.png") into myGalleryFile 
          
put url("file:"&myGalleryFile) into url ("ftp://" & FTPUSER & ":" & FTPPASS & "@" & FTPHOST&"/path_to_mydocs_on_my_server/mytest.png" )
end mouseUp
I get a file mytest.png with 271 KB. It claims it is a png file type - but if I try opening it in a graphics program it says won't open "not a valid png" If I try clicking on it - "the file is corrupt, too large..."

Re: mobilepickphoto file type and ftp

Posted: Tue Oct 16, 2012 3:30 pm
by cusingerBUSCw5N
OK. so the solution, provided through another post is to use binfile. Works like a charm. It is still a bit slow - initially shows up as 0 size, but if you wait a minute or so, it comes through.


put url("binfile:"&myGalleryFile) into url ("ftp://" & FTPUSER & ":" & FTPPASS & "@" & FTPHOST&"/path_to_folder/" &tFileName)

Re: mobilepickphoto file type and ftp

Posted: Sun Oct 21, 2012 3:27 pm
by qberty1337
Keep in mind that you should ONLY use binfile for...binary files (who would have thought?). Images, music, encrypted documents, software. NOT text files, or ANYTHING that contains plaintext. Binfile is slower then file, for a good reason too.

It's also not a good idea to FTP from Android. At least not yet. If you can find a way to secure your account information, then it'd be okay.

Re: mobilepickphoto file type and ftp

Posted: Sun Oct 21, 2012 4:51 pm
by Mark
Hi,

To avoid confusion, I'd like to remark that there are many situations in which you'd want to use binfile for text files. Basically, use binfile whenever you don't want ASCII 13 to be converted to ASCII 10. I don't think that "binfile" is slower than "file".

If you are concerned about the security of your login data, then FTP is never a good idea. Whether you're using a desktop PC or Mac, an iOS device or an Android is irrelevant.

Kind regards,

Mark

Re: mobilepickphoto file type and ftp

Posted: Tue Oct 23, 2012 2:33 am
by qberty1337
Actually, using FTP straight from Android IS different then through the PC or Mac. THe coding may be the same, but the security on how outbound connections take place on an android device is extremely different.

Re: mobilepickphoto file type and ftp

Posted: Tue Oct 23, 2012 6:06 am
by jacque
Now I'm curious. Different how? I thought ftp was always plaintext regardless of platform.

Re: mobilepickphoto file type and ftp

Posted: Tue Oct 23, 2012 8:38 am
by qberty1337
Well usually anyone that deals with android kernels and custom ROMs, you tend to find out things you haven't actually thought about.

For Android, at the moment, outbound connections are a security risk. A major one depending on your ISP/Carrier.

A lot of popular Carriers put their own proprietary software bundled into the phone, as well as some others like to replace bigger parts of Androids system (HTC - Sense, Samsung - TouchWiz, Motorola - Motoblur etc..) A lot of these "versions" of Android have various data collection services running in the background. As FTPeS/Se are not support yet on Android, it wouldn't be wise to play with valuable information in Livecode compiled apps. They are significantly easier to get into rather than standard APK's. (which is why i'm so eager for LiveCode Embedded).

(Also for the record, binfiling an encrypted SQL database is significantly slower than just filing it. Try it with SQL's over 45 MB's ex. forum db's, game db's)

Re: mobilepickphoto file type and ftp

Posted: Tue Oct 23, 2012 9:23 pm
by jacque
Apparently even apps that use SSL are not secure, I just read a warning yesterday that a good number of Android apps are vulnerable to all sorts of data hijacking. Thanks for the info though, it sounds like I'll have to keep my device turned off and in the closet if this gets any worse.

Re: mobilepickphoto file type and ftp

Posted: Wed Oct 24, 2012 5:30 am
by qberty1337
jacque wrote:Apparently even apps that use SSL are not secure, I just read a warning yesterday that a good number of Android apps are vulnerable to all sorts of data hijacking. Thanks for the info though, it sounds like I'll have to keep my device turned off and in the closet if this gets any worse.
lol well I wouldn't go that far. Just don't store any TOO PERSONAL data on them just YET.

Re: mobilepickphoto file type and ftp

Posted: Mon Nov 05, 2012 12:14 pm
by Mark
Hi,

I think that I should add that even though the way Android makes a connection is different, FTP is insecure independently of this, because data are sent unencrypted. If you're using WIFI, the data can be read with a port sniffer as soon as it arrives at your router and between your router and the server there are many places where someone might install a port sniffer. That's why I said FTP is never save.

Kind regards,

Mark