Android Example Select,Upload,Display,Delete image from Server

Hello everyone,

First of all, I want thank Erel, DonManfred and KMatle because a lot of the codes for them.

In this example (Select an image from gallery and display it, Resize the image, Save the image from Imageview to app's folder, Upload the image to the server, Display the image from the server, Delete the image from the server and last choice Delete all images from the server.

## Note:

You should upload php files directly in your website not in sub folder.
Create folder "uploads" together in same place.
Change "xxxx" from the url to your url.

myimage-png.62917



I update the app > get images as list in ListView and click on it to display the image.

screenshot_2017-12-19-13-57-22-jpg.62918



I hope this example help you.
 

Attachments

  • php_Files.zip
    2.3 KB · Views: 1,045
  • MyImage.png
    MyImage.png
    56.2 KB · Views: 4,196
  • Screenshot_2017-12-19-13-57-22.jpg
    Screenshot_2017-12-19-13-57-22.jpg
    406.4 KB · Views: 3,521
  • complete.zip
    94 KB · Views: 1,199
Last edited:

KMatle

Expert
Licensed User
Longtime User
You should upload php files directly in your website not in sub folder.

Why? For security reasons you should store any data in subfolders which are protected with a pw. Another reason is to organize the pics (like you don't store everythin on your desktop :) ). Anyway: Nice example
 

MohammadNew

Active Member
Licensed User
Longtime User
Why? For security reasons you should store any data in subfolders which are protected with a pw. Another reason is to organize the pics (like you don't store everythin on your desktop :) ). Anyway: Nice example

Hello KMatle, good point the security. But I mean the new users to do it step by step and we can put php files everywhere then refer the place in our link.

Thanks KMatle
 

tsteward

Well-Known Member
Licensed User
Longtime User
There seems to be a problem with the php file "Multipartpost.php" $file_handle is never given a value and Null causes issues.
I don't know how to resolve this

Response from server: ["chip.jpg","gralogo.JPG","mack.jpg","Spring.jpg"]
<br />
<b>Warning</b>: fwrite() expects parameter 1 to be resource, null given in <b>/srv/disk9/1833309/www/XXX.com/multipartpost.php</b> on line <b>54</b><br />
<br />
<b>Warning</b>: fwrite() expects parameter 1 to be resource, null given in <b>/srv/disk9/1833309/www/XXX.com/multipartpost.php</b> on line <b>58</b><br />
<br />
 

DonManfred

Expert
Licensed User
Longtime User
There seems to be a problem with the php file "Multipartpost.php" $file_handle is never given a value and Null causes issues.
he copied parts of an old php script of mine (See Multipart fileupload link in my Signature). The lines where the logfile is generated are missing. Due to this $file_handle is not set...
Remove/comment the lines or add a
PHP:
$file_handle = fopen('./logs/mylogfile_'.date("Y-W", time()).'.log', 'a+');
somewhere at the beginning.
 
Top