Grow your CSS skills. Land your dream job.

Upload images

  • # June 22, 2013 at 8:13 am

    I need some help. I have my website, wich will have a backoffice to insert data, and a front end that will do some querys to databse.

    I want to be able to upload images when i insert a new data. here is the form, here i want to upload images:

    http://i.imgur.com/jKYjxl4.jpg

    But i want the images to be stored in a folder, not in the database. Like images/$id

    So when i enter a new data, it will create a folder with the id of the data i insert on the database, and upload the images to there. Other thing i want is to upload several images, so i upload one, and when that field already have a image, it will display another field so i can upload more.

    Then when i display them, i want to display like a thumbnail for the first image i insert, and then when i click, the image will be displayed in real size, and i can click and nagivate to the others, like a galery. So i think the best is to resize the images to 800×600 and create a thumbnail to the 1st one i guess.

    Can someone help me?

    # June 23, 2013 at 3:59 am

    What have you tried so far.

    You can’t just state a bunch of requirements and expect us to do all the work for you.

    Are you using a CMS?

    If not, have you though about using one?

    # June 23, 2013 at 5:00 am

    > But i want the images to be stored in a folder, not in the database. Like images/$id

    This is common sense. You do not store images in a database, you store paths.

    # June 23, 2013 at 7:12 am

    No im not using CMS. This is for the final project of my course, i cant use cms, since if i use it, i just would have to install plugins and my work was done ..

    # June 23, 2013 at 7:16 am

    Then I repeat…

    >What have you tried so far>

    >You can’t just state a bunch of requirements and expect us to do all the work for you.

    # June 24, 2013 at 5:03 pm

    can someone give me a good tutorial so i can start to make? like upload images to a folder. i cant find any good

    # June 25, 2013 at 5:17 pm

    So i was working on this, and the images are uploaded, the many i select, they go for the folder. but only the path of one is stored on the bd. So what i want to do is like, everytime i insert a new place, that will contain several images, i want it to create a folder with the id of the place, and all the images will go into to the folder. so only the folder path will be stored in db, and when i list a place, i will get all the images of that place.

    like:

    images/place1 (but not place1, just the id of the place)
    images/place2

    This is what i got for now:

    http://codepad.org/w8lKpJKt

    # June 25, 2013 at 5:35 pm

    I’m not sure this forum is the best way to display some PHP code. Why don’t you try http://codepad.org/ ?

    # June 26, 2013 at 9:29 am

    nobody?

    # June 26, 2013 at 9:33 am

    If no mistake `move_uploaded_file` creates path if it doesn’t exist. So if you want to move the file to a folder that doesn’t exist, the function will create it and drop the file in.

    # July 19, 2013 at 4:27 am

    $dir = ‘myDir’;
    if ( !file_exists($dir) ) {
    mkdir ($dir, 0777);
    }

    # July 19, 2013 at 7:17 am

    nice discussion

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".