Page 1 of 1
Is it possible to auto upload image to mysql via php?
Posted: Wed Mar 23, 2011 1:49 am
by franziss
I need to upload an image using php and store the image as blob in mysql. I understand the standard way is to create a form for the user, let the user choose the image to upload, click submit.
But can I create a php, for example, uploadImage.php?image="c:\myPhoto.jpg"
and when I type http:\\www.myhome.com\uploadImage.php?image="c:\myPhoto.jpg"
from my pc, I can automatically upload myPhoto.jpg to the myhome.com server?
Thank you for your kind help.
Re: Is it possible to auto upload image to mysql via php?
Posted: Wed Mar 23, 2011 5:09 am
by litebearer
where is the image coming from? how will the script know which image?
Re: Is it possible to auto upload image to mysql via php?
Posted: Wed Mar 23, 2011 9:21 am
by franziss
The image will come from the user. For example, the user has an image c:\myPhoto.jpg
So he will open his webbrowser, type http:\\www.myhome.com\uploadImage.php?image="c:\myPhoto.jpg"
to upload his image to the server myhome.com
Re: Is it possible to auto upload image to mysql via php?
Posted: Wed Mar 23, 2011 10:25 am
by litebearer
What rationale do you have for user having to type all of that when 2 or 3 clicks of a form accomplishes the same thing?
Re: Is it possible to auto upload image to mysql via php?
Posted: Wed Mar 23, 2011 9:28 pm
by franziss
This is for a project, where the user is supposed to upload the image through this way. Of course the user does not manually type the address to upload, there will be a script doing this. Is there a way to do this? I tried using this way
Code: Select all
$image = $_GET['image'];
$handle = fopen($image, "rb");
but it doesn't work, seems like it tries to look for the file in the server, instead of the client PC.
Re: Is it possible to auto upload image to mysql via php?
Posted: Thu Mar 24, 2011 6:25 am
by litebearer
who/what executes the script that is to be used to upload the file? where will that script reside?
Re: Is it possible to auto upload image to mysql via php?
Posted: Thu Mar 24, 2011 8:27 am
by franziss
The user will execute the script to upload the file in his PC, so the script will reside in the user PC.
Re: Is it possible to auto upload image to mysql via php?
Posted: Thu Mar 24, 2011 8:32 am
by litebearer
So the user has apache and php installed on his computer?
Re: Is it possible to auto upload image to mysql via php?
Posted: Thu Mar 24, 2011 8:48 am
by franziss
er... actually I am not sure about this part, this will be done by my teammate, my task is to provide him the this php api
http:\\www.myhome.com\uploadImage.php?image="c:\myPhoto.jpg"