How To UPload Image/Resume/File in php
1 Create a form in html fields names are name, address...etc and file field for upload a file just like code below.
<input type="file" id="image" name="image" class="form-control" placeholder="Movie image" required="">
2 Then create DB field in php myadmin field name=image, type verchar...etc.
3 Then write code in your page print_r($_FILES); php print all information related to your file on your page
Array ( [image] => Array ( [name] => Hydrangeas.jpg [type] => image/jpeg [tmp_name] => C:\xampp\tmp\php7E66.tmp [error] => 0 [size] => 595284 ) )
4 then write a copy command to copy image from php tmp folder to your website image folder just like below
copy($_FILES['image']['tmp_name'], 'images/'.$_FILES['image']['name'] );
Means you copy your image in images folder with image name but image not show in your DB table only show image name in your DB table.
5 So If you want to show image in your fetch table just apply below code to show image in fetch table.
<td><img src="images/<?php echo $data['image'];?>" height="50" width="50"> </td>
Comments
Post a Comment