www.webdeveloper.com
Results 1 to 6 of 6

Thread: Question about multiple Uploads

  1. #1
    Join Date
    Feb 2011
    Posts
    177

    Question Question about multiple Uploads

    I have a code that simply uploads an image to a certain file. Easy said easy done. My question is this 1 is it possible to upload multiple images for one product. 2 can I make PHP take a photo and re size it to say 150x150 for small and 250x250 for large? 3 would it be better to just show those images by themselves or make them into a slide show?

    I can show the code I have if that will help explain what I need.

    Thanks in advance.

  2. #2
    Join Date
    Mar 2011
    Location
    Lago Vista, TX
    Posts
    4
    Yes, it is possible to upload multiple images at one time. You can find that on the PHP manual http://php.net/manual/en/features.fi...d.multiple.php.

    As far as resizing images, I assume you mean creating thumbnails on upload. If so, you can also resize images with PHP, but you will need to use a special extension called GD to do it. Go to php.net and install GD if you don't already have it. Then, check out this site for resizing images. It has all of the code written for you. All you have to do is write a few lines of code to make it work: http://www.white-hat-web-design.co.u...e-resizing.php.

    As far as your third question is concerned, that is more subjective. I'd have to see the site to give you my opinion.

  3. #3
    Join Date
    Feb 2011
    Posts
    177

    Thumbs up Thank you

    Ill try that and see if it works.

  4. #4
    Join Date
    Mar 2011
    Posts
    20
    Hello, dear i have tried for multiple upload as mention u above but only one image upload at the same time. what's the problem i could not find it.
    move_uploaded_file(
    $_FILES["pictures"]["tmp_name"][$key],
    $_FILES["pictures"]["name"][$key]
    ) or die("Problems with upload");

  5. #5
    Join Date
    Mar 2011
    Location
    Lago Vista, TX
    Posts
    4
    PHP Code:
    <?php
    $uploads_dir 
    '/uploads';
    foreach (
    $_FILES["pictures"]["error"] as $key => $error) {
        if (
    $error == UPLOAD_ERR_OK) {
            
    $tmp_name $_FILES["pictures"]["tmp_name"][$key];
            
    $name $_FILES["pictures"]["name"][$key];
            
    move_uploaded_file($tmp_name"$uploads_dir/$name");
        }
    }
    ?>
    This is a snippet directly from the PHP manual that shows how to upload multiple files. You can find it at http://us.php.net/manual/en/function...oaded-file.php.

    I also meant to mention that you should ensure that you have the ability to upload files on the server you are on and that you have your php.ini file setup properly to allow uploads.
    Last edited by stoneman30; 03-13-2011 at 09:32 PM.

  6. #6
    Join Date
    Mar 2011
    Location
    Lago Vista, TX
    Posts
    4
    One more thing. You may have an issue with your files being too big. Check out http://www.radinks.com/upload/config.php if you are having issues with large image file sizes. It shows you how to configure the php.ini file so that it can handle larger uploads.
    Learn PHP code, HTML, CSS, Javascript, MySQL, eCommerce techniques and more with free lessons from SirTechALot.com.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles