Save few Images, upload them file by file and then delete them

Hi,

I am trying to take some images with the camera and after done, upload them one by one to my server.

Taking them, save them with other names etc is working, but when I am trying to upload them, only the LAST taken image will be uploaded.

Any Idea?

Because global pathPic is the path to the last picture you saved, so you post the same file for each iteration, the last one....

Dear Tim,

Thank you, of course you are wright !!!

But what should be the correct block here :thinking:

You are missing a global variable, and you have named an existing global variable (Counter) ambiguously.

You need two counters:

  • PicturesTakenCounter
  • PicturesUploadedCounter

Something like this

I didn't bother with all the canvas save stuff, not necessary, the images are named with a millisecond value by the camera component.

1 Like

Wow thank you very much, I will test when I am back at home !!

I need the pictures as jpg, therefore the canvas save as...

The camera pictures are actually jpg, but they are given the wrong extension by the component (at the moment). You can change the extension or use the ImageConvertor extension to do this. (You can also resize images if you want to, in order to improve upload times)

1 Like

Ok, thats intersting.

But my images need also a special name, so that they can be assigned later for further handling on the server

Then just rename using blocks.

Your original blocks would overwrite images if you did a second run of the app, because you would start at 1 again....

I already tried it but got a lot of errors like "image does not exist" eg

That doesnt matter, as soon as they are on the server (with special name containing date and time of upload) i do not neef them any more on the device

Looking at your upload url, it appears you can set the filename on the server, regardless of the name of the file you actually upload ? In which case, changing the filename to your "special name" should be trivial ?

You are wright, I can set names at Server, Thank you !!!!

It is working, thank you very much Tim.

1 Like

I have to come back again to this....

Is there any possibility to view the taken images alltogether before uploading?

They are not showing in the phones Gallery....

You could try this:

Image Grid with HTML

1 Like

Dear Tim,

Thank you very much again for your help (will make a contribution to Liveboats :wink:)

I solved it using this one:

Thanks also to @Mark_blouzoopa for the blocks!!

Last thing I have to do now is to delete all images stored in /Pictures/ (so all images taken by the camera as I do upload them to my server, so i do not need them any more on the device)

Is there any way to delete ALL files in this directory?

1 Like

I tried this, but unfortunately every time i press btnDelete the companion is crashing...

The File component uses / needs a β†’ relative path:

but you use a β†’ full path:
grafik

See also here:

Hi Anke,

Thank you very much for your reply!!!!

Here is the result of FilesToDelete:

But when I press btnDelete I get "Sorry, file to delete does not exist"