Fukzzs miniblogs

  • Fukzzs
    0

    Kāpēc šis kods man kkā divaini un nepareizi strādā. Ja saglabā kādus 3 failus vai divus. Tad viss ok. Bet kad mēģina vairāk pa 4 vai kaut kā tā. nekas nenotiek. Reku pati lapa. http://oskars.info.tm/adminpanel/showgallery?gallery=test

    un kods.


       <form action="showgallery.php?gallery=<?php echo $gallery ?>" method="post" enctype="multipart/form-data">
       <input type="hidden" name="MAX_FILE_SIZE" value="20000000000000" />
    <input type="file" value="" name="upload[]" multiple>
    <button type="submit">Upload!</button>
    </form>

    <?php
    $gallery = $_GET['gallery'];
    $error_message[0] = "Unknown problem with upload.";
    $error_message[1] = "Uploaded file too large (load_max_filesize).";
    $error_message[2] = "Uploaded file too large (MAX_FILE_SIZE).";
    $error_message[3] = "File was only partially uploaded.";
    $error_message[4] = "Choose a file to upload.";

    $upload_dir  = "../gallery/photos/$gallery/";
    $num_files = count($_FILES['upload']['name']);

    for ($i=0; $i < $num_files; $i++)
    {
       $upload_file = $upload_dir . urlencode(basename($_FILES['upload']['name'][$i]));

       if (!preg_match("/(gif|jpg|JPG|jpeg|png)$/",$_FILES['upload']['name'][$i])) {
           print "I asked for an image...";
       } else {
           if (@is uploaded file($_FILES['upload']['tmp_name'][$i])) {
               if (@move uploaded file($_FILES['upload']['tmp_name'][$i],
                   $upload_file)) {
                   /* Great success... */
                   echo "hooray";
                   //$content = file_get_contents($upload_file);
                   //print $content;
               } else {
                   print $error_message[$_FILES['upload']['error'][$i]];
               }
           } else {
               print $error_message[$_FILES['upload']['error'][$i]];
           }    
       }
    }
    ?>

    Kods no šejienes. 

    http://www.hyperorg.com/blogger/2012/09/09/beginner2beginner-javascript-multi-file-upload-php-to-process-it/


    • Fukzzs
      0

      Tad kāds lūdzu nevarētu ar šo palīdzēt?

      • S J
        0

        Izlasi dokumentāciju...

        • Fukzzs
          0

          Neko tādu kas man palīdzētu neizlasīju. Lkm stulbs esmu.

    • mad
      0

      Cik lieli faili? Iespējams pārsniedz php konfigurācijā norādīto max upload size.

      • Fukzzs
        0

        Faili ir parastas bildes. un visur ir uzlikts pietiekoši max upload size. :/

    Atpakaļ Uz augšu