Android Question send files to vps or host

Douglas Farias

Expert
Licensed User
Longtime User
hi i have a simple question

i m making a app social, same facebook
i need a ideia.

i need to make for all users can send your photos to my vps
and i need to save this photos in a folder

exemple
user erer = folder erel with erel photos

user douglas = folder douglas with douglas photos

its possible?
what the best way to make this?
 

Douglas Farias

Expert
Licensed User
Longtime User
i need to make 2
client for all user app
and server to receiv all user photos

i tested your exemple in my vps
http://www.b4x.com/android/forum/threads/b4aserver-files.9679/

this works fine send and receive files

but i need to make for the user for exemple send hes photo and save it on hes folder

user erel

create a folder erel and send photos only to erel folder

user douglas send only to douglas folder etc *-*
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You also can use php for the server-side which gets the file and stores it in HDD... It also can create the folder if needed...
PS: See my Signature for an example (without creating the folder)
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
hmm
and how to know a exacty folder

exemple you is my app user
you want upload a photo , you take a photo in my app and click in send
your facebookid is = 10101010

when you click in send

function = go to my vps, create a folder 10101010 and save the photo 1.jpg

later i go need call this
go to my vps take a 1.jpg from 10101010 folder


all users go need a folder

the best way is with php?

and it is safe? for exemple other user can acess the all folders?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
It does not matter in which language you want to write it... It can be php, it can be b4j. Use the language you prefer.

Due to security; it does´nt matter which language you use. You have to deal with the security-issues... It´s up to you to make your webserver save
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
but is possible to change the save directory?
$file_path = "uploads/";

$file_path = "uploads/idoffacebook";

exemple
user Douglas id= 10101010

$file_path = "uploads/10101010";

?
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
i know send a id but i dont know receiv this on the php *-* to make a folder
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
thanks man, I'm not a programmer, I'll get to the end to make it * - *
thanks for the tips I will buy a cloud vps tomorrow to start testing.

I will install xampp and apache to do this part.
need to give some permição php.ini for these functions?
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
another questions

1° your link to upload file in your example is http://www.vdfb.de/b4a/multipartpost.php correct?
when i have my vps can i use http://192.111.111.11/b4a/multipartpost.php for example?

2° in the app for set the user id i go make this

http://www.vdfb.de/b4a/multipartpost.php & id ?
for exemple my id is : 101010

http://www.vdfb.de/b4a/multipartpost.php101010 ? or i need set other parameters?
http://www.vdfb.de/b4a/multipartpost.php?101010
http://www.vdfb.de/b4a/multipartpost.php?id=101010
http://www.vdfb.de/b4a/multipartpost.php?id= & id

what the correct link can i send to my vps to in vps receive this in php?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
with an working xampp these commands should not make problems. They should be useable.

with my above code
PHP:
if (isset($_REQUEST['id'])){$id=intval($_REQUEST['id']);} else {$id=0;}

it should be
"http://www.vdfb.de/b4a/multipartpost.php?id="&id

or look at my app-example (see signature)... there is a map with values used to post to the php...
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
DonManfred your exemple works fine
i get the id sended by app and make a folder in php with mkdir($id)
ok perfect

now my other question

how i make to get this photo for exemple

i open the app

if user already registered
get photo from http://myvps/IDUSERFOLDER/1.png


how comand can i use to get photos and call this to image view

go to http:/myvps/userid/1.png

download this and put in imageview *-* ?
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
Simply provide or check the URL which will be shown in a webview ?
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
yes but i need save this because in the folder go have 5+ images

/1.png 2.png etc *-*
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
Ok. So you have basically three choices : or to store the image's name in a file or database or to rename the chosen image as avatar.PNG. You'll have to decide
 
Upvote 0
Top