Whats the best way to store images in php?

3 replies
I want to store images on the server using php script, I want to know which way is better to store images using php?

Thanks in advance,
#images #php #store
  • Profile picture of the author skillboyz
    There are two ways to store images on the server either using blob data type in mysql and by uploading to the folder and store path in mysql database
    {{ DiscussionBoard.errors[8308958].message }}
  • Profile picture of the author sktthemes
    Hello,
    Their are two things needs to do for storing images on server
    1) Store image file name in mysql table
    2) create one folder 'upload' on server and move image in it

    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
    {{ DiscussionBoard.errors[8309531].message }}
  • Profile picture of the author kiash001
    I agree with sktthemes. It is the best way to store image. If you want to handle massive amount of image you can upload them into date based directory like
    uploads/dd-mm-YYYY/
    and you can also rename them unique using
    uniqid
    function.
    {{ DiscussionBoard.errors[8325603].message }}

Trending Topics