Upload Image File to Server

Thank you.
do you have any clue why I keep getting error 1104:
error1104n

Because the path is incorrect

Taifun

2 Likes

great.
thank you.

can you help why the upload never happened?
the Label8 and Label9 all shown, but the receiver side got nothing.

I have tried below not work:
Capturenn2

1 Like

The web component cannot handle a multipart upload.

See here for some background

Note this is off topic...will be moved.

The File component uses a relative path (not an absolute path).

1 Like

thanks.
tested not work.
I try to use block below got errors:

got error:
block2
block3

Again, the File component uses a relative path!

/storage/emulated/0/Pictures/Telegram/IMG_20250715232624_409.jpg

1 Like

thanks.
I'll tested that not work.

like this one got error:
bb5

my phone is 5.0, is it ok to call a image from shared folder to upload? tested not work call image from APP.

  1. Use the same MakeFullPath block to construct your ASD path. You may need to remove the file:// prefix from both paths...
  2. You need to use the Async Copy Event block to handle all your blocks after to copy the file
1 Like

Thanks.
still failed to use the saved image.
used 5.0 phone

  1. for camera taken picture the block uploaded ok:

  2. for saved picture searched name: IMG_20250715232624_409.jpg ; the block uploaded failed:

bbb5

  1. try to copy the specific file failed:

bbb9

list shown there is no copied file there:

bbb10

@TIMAI2 already mentioned it earlier

Taifun

1 Like

Thanks.
5.0 phone.
I've checked that The web component cannot handle a multipart upload. I listed here for one thing is to compare the taken-picture and the saved picture;

main thing is how to operate the saved picture, lets say copy a saved picture ( IMG_20250715232624_409.jpg) to another name (dog.jpg)?
" 3) try to copy the specific file failed: "

so why are you posting a lot of irrelevant screenshots?
to confuse others?
where is your file? in shared storage or in ASD?
just use the correct path...
and if you want to use the CopyAsync method of my file extension, then you should conitinue in the Copied event... protip: read the ducumentation at App Inventor Extensions: File | Pura Vida Apps

Taifun

1 Like

Might help if you show what is happening at the receiving end, upload_picture. Is it PHP?

1 Like

:question: .

1 Like

This works fine on Android 6 tablet:

php file on local server

<?php
// Simple PHP script to save image file.
$imgDir = "upload/";
$fileName = $_REQUEST['fname'];
$data = file_get_contents('php://input');
$store = file_put_contents($imgDir.$fileName, $data);
if  ($store !== false ) {
echo "File $fileName saved to server, $store bytes\n";
} else {
echo "File $fileName not saved\n";
}
?>

What else do you need to do?

1 Like

Thank.
sorry I didn't described clearly.

The three items and photos in that post truly illustrate the three test results.

  1. test set phone camera taken picture and uploaded successed with block illustrate;

  2. when used the saved picture to do the upload failed. the saved picture is searched out with name of: IMG_20250715232624_409.jpg located in: /storage/emulated/0/Pictures/Telegram/IMG_20250715232624_409.jpg; the block picture shown the failed uploaded sketch.

I just awareness that: The web component cannot handle a multipart upload.

  1. try to copy the specific file failed: this question resulted from 1) and 2), because of upload saved picture failed, I try to copy a saved picture into another name, but the copy failed

yes, I tested TaifunFile1.CopyAsync from: FileScope: Shared + /Pictures/Telegram/IMG_20250715232624_409.jpg ; to FileScope: Shared + /Download/dog.jpg
didn;t copy.
.

Thanks.
the receiver is ESP32S3 with 1.9" TFT without PHP.
that did receive phone camera taken picture and displayed, even the displaying is serious distortion.

thanks.
I used Android 5.1.1 (Lollipop) for now just because of I used to it.
I have a Samsung Galaxy A16 phone with Android 14, scared to use it if there is too many changes needed.

Thanks.

I'll test this.

what I like to do now is upload phone take picture and pictures saved in my phone to ESP32's AP web.
not have a real real web yet.