java - How to upload images from client side to server side and retrieve them dynamically -


i new uploading files. there way upload image user on website , when other users view website images shown them. various websites user post ad images , when other users view post can view images.

tried store , retrieve them into/from database, loading of images slow. want store them in folder on server, , when particular post viewed images should retrieve.

can me solve this?

index.php:

<form action="upload.php" method="post" enctype="multipart/form-data">   <lable>select file upload ... </lable>   <input type="file" name="imageupload" required>   <br>   <input type="submit" value="upload"> </form> 

upload.php:

<?php      if (isset($_files['imageupload'])) {       $imagename = $_files['imageupload']['name'];       $imagetemp = $_files['imageupload']['tmp_name'];     }     if (!$imagetemp) {         echo "you need select file upload";     } else {         move_uploaded_file($imagetemp, "upload/$imagename");     }  ?> 

now enough insert location database:

   insert `database name`.`table name` (`filde name`) values ('[domain address]/upload/$imagename'); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -