[Solved]How do I upload the File chooser's local image

Get help using Construct 2

Post » Sat Aug 23, 2014 4:39 pm

In my app, I want to implement the following:
1. Insert a File chooser and a sprite plugins. (ok)
2. Add event: (ok)
condition: FileChooser On changed
action: sprite Load image from FileChooser.FileURLAt(0)
3. upload the above local image to the server. (I don't know how to do it.)

I think I should use the AJAX to call a serverside php, but what's the parameter I should write?

Thanks a lot.
--------------------------
Solution:
1. Refer to https://www.scirra.com/forum/ajax-image-request-troubles_t112942?&hilit=save+image+to+server&start=10, use Pode's ExtractImage plugin to convert the image to a base64 string.

2. Refer to https://www.scirra.com/forum/viewtopic.php?f=147&t=92690&p=723457&hilit=save+image+to+server#p723457, write your own PHP script.

3. Pass the base64 string to PHP script by AJAX plugin's action Post to URL.

Thank you, @angellondon, @Pode, @GameThirsty, and all.
B
37
S
4
G
2
Posts: 45
Reputation: 3,997

Post » Fri Sep 05, 2014 9:26 am

Hi KennyOops

Just what I could use, can the file chooser default look in mobile camera gallery

BTW. Do you have a working sample.capx

Cheers
Flemming
B
33
S
17
G
11
Posts: 350
Reputation: 8,695

Post » Mon Sep 15, 2014 10:20 pm

wow thanks for this posts i was looking for ages for this info and try alone a lot of time but fail
yolinux
B
18
S
5
Posts: 19
Reputation: 1,545

Post » Wed Oct 22, 2014 8:46 pm

is possible to make work with JSON file?

like, some user make their levels, construct will convert an array in a JSON string, and the php will make a JSON file?

how work this for the picture? I mean, JSON is a string, AJAXcan send like 2000 characters or something like that... but if my JSON file is big than 2000 characters, how I can send a data to a PHP?

I don't understand... :?:
B
21
S
9
Posts: 298
Reputation: 2,967

Post » Sat Oct 25, 2014 2:09 am

Ribis wrote:is possible to make work with JSON file?

like, some user make their levels, construct will convert an array in a JSON string, and the php will make a JSON file?

how work this for the picture? I mean, JSON is a string, AJAXcan send like 2000 characters or something like that... but if my JSON file is big than 2000 characters, how I can send a data to a PHP?

I don't understand... :?:


Sorry, I don't know how to use JSON. I never use it before.
B
37
S
4
G
2
Posts: 45
Reputation: 3,997

Post » Mon Jan 19, 2015 2:00 pm

Thanks :D
B
4
Posts: 4
Reputation: 208

Post » Sun Dec 04, 2016 1:02 pm

Hi dear Pode!
Inject Image behavior dosn't work when webgl is on
B
3
Posts: 5
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: engin20020, plinkie, rbailey83, tarek2 and 20 guests