Php upload image to directory

后端 未结 6 388
野的像风
野的像风 2021-01-13 16:25

Ive been experimenting with the upload capability of php, I have been looking at this tutorial on w3school.

http://www.w3schools.com/php/php_file_upload.asp
         


        
6条回答
  •  -上瘾入骨i
    2021-01-13 17:25

    best way to upload images i think would be to copy an image and store inside a folder and then store the new location of image into a databse.

    to move the file we can use move_uploaded_file function

    $oldpath = $_FILES['image']['tmp_name'];
    $newpath ="new_folder_location/".$_FILES['image']['name'];
    move_uploaded_file($oldpath, $newpath);
    

提交回复
热议问题