last day (15 days later) » 

3:53 AM
2
A: simple upload of image in database for sign up user

medaHere is a simple example of how to achieve that: if(is_uploaded_file($_FILES['image']['tmp_name'])){ $folder = "upload/"; $file = basename( $_FILES['image']['name']); $full_path = $folder.$file; if(move_uploaded_file($_FILES['image']['tmp_name'], $full_path)) { echo ...

 
@satinekianne you are welcome, you can learn more about it here php.net/manual/en/function.move-uploaded-file.php
 
ok sir will be back on you about this..thank you..
$_FILES['image']['tmp_name'] in this line the 'image' is the name of the button right sir?the name="image" of the input button?
 
Yes exactly it should match the name of the input file tag
 
sir can you look at update i dont get why i get undefined index ive search in net and you said the image is the name in the input but why do i get undefined index in here?any other ideas?
 
Add this to your form enctype="multipart/form-data"
 
3:53 AM
last question sir how do i correctly name a folder for example in my case my using local host..what i did is C:\Users\satinekianne\xampp\htdocs\images\` but i get error failed to open stream: No such file or directory in`
sir no problem i got the image i used ``` instead of ``` i got uploaded now thank you for your advice and answers
 
@satinekianne
this line
$folder = "upload/"
if your php script is in the htdocs folder
then change it to
$folder = "image/";
 
yes i got the answer is i did double \\ right?
 
no you can write it line linux style
$folder = "image/";
 
now im doing the retrieving of the image i will show it in an html can you help me sir?
i will try it that way sir wait give me a few minutes..i will be back with the result
 
okay
 
3:55 AM
the "image/" will be the folder name right?
 
its up to you
you can call it how you like it
in my example it was upload
 
Warning: move_uploaded_file(image/1.JPG): failed to open stream: No such file or directory in C:\Users\satinekianne\xampp\htdocs\connectiontodb\crud.php on line 64
im getting error when i try it like
$folder = "image/";
 
have you created the folder image?
 
in htdoc or in the folder where the file is located?
 
yes
 
4:01 AM
yeah is working thank you so much sir you helped me so much..
 
you are very welcome
 
im going on to the next step now
can you help me with retrieving the image if it is ok with you?
retrieving data is like retrieve other data sir?
i mean getting image?cause i just saw that the file path is the one saved
 
yes very easy
SELECT img_url FROM table
 
wont the url show?i mean the string url or the image with show?
 
when you can echo the row
the image i mean
 
4:09 AM
how do you echo and show image its kind of funny i tried it like <?php echo $image; ?> then the url showed images/2.png
 
echo '<img src="image/'.$row['img_url'].'">";
 
let me try it sir thank you for all your help sir i really appreciate it
thank you so much
 
sure
 

  last day (15 days later) »