[x] Drogi Czytelniku, wygląda na to, że korzystasz z oprogramowania blokującego wyświetlanie reklam. Wyświetlane tu reklamy nie mają inwazyjnej formy i nie utrudnią Ci nawigacji, a środki z reklam pozwalają mi utrzymać serwis i pomagają w jego dalszym rozwoju. Z góry dziękuję za wyrozumiałość.

Simple Share — English

About app

Sim­ple Share is an appli­ca­tion for Android that allows you to quic­kly send ima­ges to your server. You point image and after a while you get link in clip­bo­ard, you can send ima­ges easy to some­one — some­thing like that I needed for a long time and finally … I made :)
An alter­na­tive way is to use the gal­lery appli­ca­tion and cho­ose share to Sim­ple Share — also works as above.

Instal­la­tion

The first thing we need to do after instal­ling the appli­ca­tion is to pre­pare the server for the appli­ca­tion of that.
We cre­ate on the server (in a place acces­si­ble from web) direc­tory that will con­tain the sent pic­tu­res.
In this direc­tory, cre­ate a file index.php of any con­tent (to pre­vent listing files) and file simpleshare.php with content:

<?php
$haslo = 'asd'; // auth password - you will have to enter it in app
$url = 'http://dev.kubofonista.net/up/'; // enter url to directory, with ending slash!

if($_GET['simpleshare'] != $haslo) {
	$s['simpleshare']['status'] = 0;
	$s['simpleshare']['url'] = '';
	echo json_encode($s);
	@unlink($_FILES['uploadedfile']['tmp_name']);
	die;
}

$info = getimagesize($_FILES['uploadedfile']['tmp_name']);

if(!$info) {
	$s['simpleshare']['status'] = -1;
	$s['simpleshare']['url'] = '';
	echo json_encode($s);
	@unlink($_FILES['uploadedfile']['tmp_name']);
	die;
}

$filename = substr(time(), -3).'_'.$_FILES['uploadedfile']['name'];
$target_path  = './'.$filename;

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
 $s['simpleshare']['status'] = 1;
 $s['simpleshare']['url'] = $url.$filename;
 echo json_encode($s);
} else{
 $s['simpleshare']['status'] = 500;
 $s['simpleshare']['url'] = '';
 echo json_encode($s);
}
?>

In the first line we set the access pas­sword, the same we will have to type in your appli­ca­tion, in the second line, give the path to the direc­tory with the script pla­ced, ending slash but no name /simpleshare.php, in the exam­ple shown above: http://dev.kubofonista.net/up and the pas­sword: asd

Impor­tant! PHP $url link to a direc­tory must have a final slash, in the appli­ca­tion you must enter URL without final slash!

After pro­per con­fi­gu­ra­tion of the appli­ca­tion will look for the file in the selec­ted fol­der simpleshare.php and try to com­mu­ni­cate with him, when it can — your photo will be uplo­aded to server, and a link to a file will be displayed and copied to the clip­bo­ard (which is why it is impor­tant to write the $url cor­rec­tly — the link is its con­tents + file name sent to the server)


© Kubofonista HomePage. All rights reserved.  
Icons: Sylwia Besz | Design: Theme Junkie.