# Posting an image to a php-server

**URL:** https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248
**Category:** Questions about Thunkable X
**Tags:** image, webapi, php
**Created:** [April 24, 2019, 1:44pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248 "2019-04-24T13:44:05Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 24, 2019, 1:44pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/1 "2019-04-24T13:44:05Z")

</div>

Hi

I’d like to select a picture and send it to my php-server.

I can select fine - but posting it seems to be a problem. There is no web\_api.postfile in Thunkable X.

Can anyone help me on this task?

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 24, 2019, 4:01pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/2 "2019-04-24T16:01:53Z")

</div>

Hi,

How and where do you select the file?

---

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 24, 2019, 4:46pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/3 "2019-04-24T16:46:16Z")

</div>

Hi actech - thanks for answering

I just choose through the photo\_library component.

If somewhere else is easier, then I’m game…

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 25, 2019, 7:27am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/4 "2019-04-25T07:27:31Z")

</div>

Now I understand. If you have experience with JavaScript, then I would suggest the option of working through WebViewer. To do this, open the html file in WebViewer with the form of sending the file to the server with the element

The second option is after selecting a file using to encode it in base64 format, and then you can send files anywhere (in messages or a database) in this text format. As an example, look at the scrFileViewer screen from the project (but this does not work on Android).

[https://x.thunkable.com/projects/5c8e64dfe1aad2f778a4c5ad/project/properties/designer/](https://x.thunkable.com/projects/5c8e64dfe1aad2f778a4c5ad/project/properties/designer/)

---

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 25, 2019, 9:16am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/5 "2019-04-25T09:16:59Z")

</div>

Thank you for suggesting.

I like the Jscript you made for converting to base64 - but if it doesn’t work on Android, then I cannot use it.

The first suggestion is to open a page, and then select the image through the web-page form? Just like on [https://imgur.com/upload](https://imgur.com/upload) ?  
When I go there on my normal browser (on my phone), it works just fine - but when I try through the webwiever, then nothing pops up when I click “browse”.

Thank you for the replys.

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 25, 2019, 11:22am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/6 "2019-04-25T11:22:43Z")

</div>

Yes, the file upload form can be implemented in several ways:

1. Create an html file with a form, add this file to the project and point it to the link in WebViewer
2. Open a form in WebViewer online to upload the file to the server.
3. Use the Thunkable X example from [https://docs.thunkable.com/media-db](https://docs.thunkable.com/media-db) and first save the image to the Cloudinary repository, and then send the resulting link to the saved file to the repository, for example, in your php script, which this link will save the file on your server

---

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 28, 2019, 7:22pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/7 "2019-04-28T19:22:07Z")

</div>

I would really like to avoid cloudinary, as a detour before my own server. So option 3 is out.

When I try option 1 - I’ve tried with [PHP Tutorial - File Upload](http://www.tizag.com/phpT/fileupload.php) and [Imgur: The magic of the Internet](https://imgur.com/upload) - nothing happens, when I click the “find file” button within webview. It just doesn’t seem to respond - or somehow doesn’t allow the file to be searched for.

Option 2 also seems fine, but I don’t know how - I’ve tried adding this:  
\<form action=“upload.php” method=“post” enctype=“multipart/form-data”\>  
Select image to upload:  
\<input type=“file” name=“fileToUpload” id=“fileToUpload”\>  
\<input type=“submit” value=“Upload Image” name=“submit”\>  
\</form\>  
To the body tag of the webviewer, but that didn’t do it…

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 29, 2019, 6:48am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/8 "2019-04-29T06:48:41Z")

</div>

I want to clarify one point. When you press the file selection button on Android, it is pressed, but nothing happens or a screen with applications opens with which you can select a file?

---

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 29, 2019, 7:02am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/9 "2019-04-29T07:02:13Z")

</div>

Right now - nothing happens

I would like it, if a screen opened, where you could select a file.

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 29, 2019, 7:05am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/10 "2019-04-29T07:05:12Z")

</div>

I understood. \<iput type = “file” just doesn’t work on Android in WebViewer. Try to open the file with the download form through an external browser using the “open link” block.

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 29, 2019, 7:14am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/11 "2019-04-29T07:14:49Z")

</div>

Does the external browser work?

I can’t check it out, because with Thunkable Live there’s a problem again.

---

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 29, 2019, 8:53am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/12 "2019-04-29T08:53:24Z")

</div>

But doing that - I end up in chrome, and I am no longer in my own app - with no way to get back.

![55](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/e/eeaaf79f7f4f999ca8d13e3cde7f39cb62dbcb14.png)

That is not what I want.

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 29, 2019, 9:45am UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/13 "2019-04-29T09:45:18Z")

</div>

You probably noticed that when working with Thunkable X you have to invent a lot of crutches? In fact, everything is simple - either invent crutches in Thunkable X, or use a more functional tool for developing applications for Android.

---

<div class="post-metadata">

### Author: ![engberg](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/engberg/32/31802_2.png) [@engberg](https://community.thunkable.com/u/engberg)
#### Post date: [April 29, 2019, 1:10pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/14 "2019-04-29T13:10:00Z")

</div>

Well - I’d like to invent a crutch for this - and you’ve provided important information, in that input type=file doesn’t work.

I’d like to look into the option for adding a form to webview directly - I don’t think I understand that path yet. Maybe type=file still doesn’t work there?..

I’m still open to other options for sending photos from the mobile to my php-server… It has to be possible!

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [April 29, 2019, 2:47pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/15 "2019-04-29T14:47:19Z")

</div>

Well, if I find another option, I’ll write.

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 12:13pm UTC](https://community.thunkable.com/t/posting-an-image-to-a-php-server/75248/16 "2024-11-08T12:13:53Z")

</div>


