SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there a max upload photos?

    Hi there,

    I got a simple upload photo thingie working. I have set it up, like

    - 1 user set the amount of photos he wants to upload
    - 2 with
    Code:
    $num = $_REQUEST['numOfPhotos'];
    for($counter=0;$counter<$num;$counter++) {?>
    <input name="file[]" type="file" maxlength="255">
    	 <?php }?>
    I show the appriopiate amount of input fields
    -3 than I call a upload script
    Code:
    $uploaded_file = $HTTP_POST_FILES['file'];
    $numFiles = count($HTTP_POST_FILES['file']);
    echo $numFiles;//test purpose
    while( $counter <= $numFiles )
    {
    if($uploaded_file['size'][$counter] > 0)
    {
    if(!array_key_exists($uploaded_file['type'][$counter], $known_photo_types))
     
    here all the check, insert upload ......
     
    }
    $counter++;
    }
    this all works for a maximum of 6 photos, if I want to upload say 9 the last 3 aren't being uploaded.

    Any idea how come?
    grtz

  2. #2
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you use any sort of error cheking within your upload script? It might allow you to identify the problem.

    For instance...

    PHP Code:
    if (move_uploaded_file($uploaded_file['tmp_name'][$counter], $newfile)) {
                    
         echo 
    'File '.$counter.': Uploaded<br>';

    } else {
                    
         echo 
    'File '.$counter.': Could not upload - Error '.$uploaded_file['error'][$counter].'<br>';


    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  3. #3
    SitePoint Evangelist -Oz-'s Avatar
    Join Date
    Nov 2001
    Location
    Phoenix, AZ, USA
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is it timing out?
    Oz
    GamersMark - On Target Gaming
    OzTheory - Programming and Web Solutions
    AmIBlocked - Check if you've been blocked on IM

  4. #4
    SitePoint Guru D-flyer's Avatar
    Join Date
    Jan 2001
    Location
    Near a computer
    Posts
    782
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi,

    yep I got some checks

    Code:
      if($uploaded_file['size'][$counter] > 0)
      {
       if(!array_key_exists($uploaded_file['type'][$counter], $known_photo_types))
       {
    	$result_final .= "File ".($counter+1)." is not a photo<br />";
       }
       else
       {
    time-out, hmm sounds promising but I have tested this scenario as well

    5 photos (130kb each) <- all goes well
    8 photos (50kb each) <- just 6 photos being uploaded.

    How could I display a time-out error?

  5. #5
    Are You There? KDesigns's Avatar
    Join Date
    Oct 2003
    Location
    Your Monitor
    Posts
    1,146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's possible that the server is timing out. I just recently wrote a photo gallery script for a client with the same type of thing (they choose how many photos they want to upload). 5-6 upload without a problem, but when you go any higher it seems to timeout. My solution was to simply make a dropdown selector that limited them to only choosing a maximum of 6 images at a time.

    This is also very easy to explain when you put it into the perspective of their best interest. Who wants to deal with the frustration of knowing which pictures uploaded and which didn't? By playing it safe and doing a maximum of 6 at a time, you make the uploads faster and also more efficient. (This is of course how I put it into the perspective of their best interest)
    ChooseDaily.com - Follow on Twitter
    Top Resources for Web Designers and Developers Every Day!


Bookmarks

Posting Permissions

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