Take a picture with camera and upload via php

i have added the taifun aix but i am stuck!

do i have to use copyasync?
and how i now the name of each photo that i do so i can move the file?

for example this is the name of 1 photo… but change each time

here it is also my aia filepostfile.aia (38.8 KB)

You can use the Copy method...

You can find the name in the AfterPicture event

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

thanks for the links that you posted!

in the meanwhile i tryed to see the name of image saved on smarthphone in a label
but i cannot move them in a folder that the app can see clicking on imagelistpicker1

blocks (1)

You might need to give your app permission to store files on external storage (your virtual sdcard)

android.permission.WRITE_EXTERNAL_STORAGE

(find the block in Screen1)

you might want to use a correct file name as toFIleName… you are currently using a directory name only
also the suggestion was to use the Copy method rather than the CopyAsync method…

Taifun

1
for now i move the file on that folder with a “test.jpg” name and seems that file is moved but when i click on listpickerimage1 i cannot see the photo that i did!
if i close and reopen the app i can see the image…

Seems that i need some “refresh” ?

13 posts were split to a new topic: How to use the GalleryRefresh method from the TaifunTools extension?

I have these 2 blocks… and each one does what i need!

  1. Where i do a photo and save on my smarthphone the photo

and
2)
blocks (8)
where i choice the/a photo from the smartphone and i upload on my ftp!

But Is it possible in some way to call a procedure or something like that after.Picture stores the photo in the smartphone but ALSO upload automatically on the ftp?

here also aia file
test.aia (204.1 KB)

yes of course...
just put your blocks into a procedure and call it after taking a picture

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

something like that?

blocks (10)

but i don’t know what i have to put instead of ImagePicker1.selection!
because i don’t select but i have to put the path i think, but i don’t know how to do that

maybe:
blocks (11)

tes1.aia (204.5 KB)

for the procedure you might want to define an input parameter, i.e. the image you like to upload
in the first case it is imgServer.Picture
in the second case it is ImagePicker.Selection

Taifun

Is what i tryed to do on second attempt i inserted in Path of call web1 the Path of the file from the smarthphone
I Will try with img.Server.Picture…
the other part of procedure is ok?

Thanks

please test it yourself to find it out...

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thanks i started to debug with doIT

i changed block as
blocks (13)

and doit returns for call web1 path is:
Do It Result: “/storage/emulated/0/DCIM/Camera/1587292295949.jpg”
that i think is good…

while doit of the join for web1.url is:
Do It Result: “http://cataviz.altervista.org/aaa/postfileV2.php?filename=File transfer completed.&p=secret”

there is File transfer completed instead of the name of the file :slight_smile:

test1.aia (204.8 KB)

the suggestion was to use an input parameter for the procedure, so you can use it for both cases…
see also https://appinventor.mit.edu/explore/ai2/support/concepts/procedures
also to use twice the global variable strPath in the join block of the Url does not make much sense, does it?
you might want to do some tutorials to learn the basics…

A very good way to learn App Inventor is to read the free Inventor’s Manual here in the AI2 free online eBook http://www.appinventor.org/book2 … the links are at the bottom of the Web page. The book ‘teaches’ users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

no was a wrong block to use twice the global variable strPath in the join block !! don’t know why i posted it! but aia file was different

i changed yesterday in

because in the join we need the name of the file… but maybe i need a split of it
and
blocks (5)

Here a code to upload a file by PHP (extension Base64)

thanks for the link but i can upload choicing file from smartphone… i have a problem only with the procedure to upload to call after.picture

I have updated:

Without test it… looking to your blocks every photo Will be uploaded with same name?? Callejon_arco.jpg