Click here to Skip to main content
16,017,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I make a webserver embedded in mini computer Raspberry PI. It can display image if I copy image to folder /www/ on raspberry pi
Now, I want add/send image to folder /www/ on Raspberry Pi from other PC.
How can I do this? I am a newbie in PHP. Thanks for help.
Posted
Updated 13-Jul-18 0:32am
Comments
Oso Oluwafemi Ebenezer 4-Dec-14 9:11am    
You want to learn how to upload files in PHP?
Member 10390715 4-Dec-14 9:30am    
Now, I not really too necessary. Because, earlier I can't convert binary become image and I try to copy image to /www/ folder automatic.
I can write code upload to server, but in the same PC.If you know, I willing to learn. Thanks
Oso Oluwafemi Ebenezer 4-Dec-14 9:35am    
To understand you better, are you trying to use images on another computer on your "local site"?
Member 10390715 4-Dec-14 9:58am    
No.
For example, I use mini computer Raspberry Pi (192.168.1.7) as a webserver. I connect my laptop (192.168.1.4) directly Raspberry Pi. Then I open browser type 192.168.1.7, it will send me webpage from webserver. I also make a php webpage to add data to mysql. With the image, I add the name of the image to mysql. Then I use USB copy image from my laptop to Raspberry Pi store it in folder /www/ on wamp server. I'll display image by name, like this:
<pre lang="PHP">
....
$Hinh = "www/".$row[5];
$Hinh = "<img src = '$Hinh' alt='$Ten'>";
echo $Hinh;
</pre>
But I do not like this. I don't like use USB to copy. I want to make a webpage like registration page. I can upload my avartar to this page.
But I don't know.
Sorry if my english is not good.

Oso Oluwafemi Ebenezer 4-Dec-14 10:04am    
Firstly, that code looks familiar! Especially the $Ten and $Hinh.
Anyways, you can store the image in a folder and stored the file path in the database. Post the code of where you store the name of the file to the database.

The INSERT statement is wrong, it should be
SQL
INSERT INTO table_name(column1, column2) VALUES (value1, value2)
 
Share this answer
 
first of all you need to create a database. Then you store the id or name of the images that you give in your html document.Before we try to sent to the server we had to connect server and database by

$conn = mysql_connect("hostname","mysql name", "mysql password","databasename");

mysql_select_db($conn, "db name");//or ("db name");
mysql_query("SELECT*FROM ´db table name´ ´image´="'.$imageid.'" ");
Afterthat you can sent those images from your server to the client vise versa.
 
Share this answer
 
Comments
CHill60 13-Jul-18 6:40am    
The question was asked and answered over 3 and a half years ago! Moreover, the poster of solution 1 spotted the problem and the OP accepted the answer meaning it solved the problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900