Dosya Upload Scriptinde Yüklenecek Dizini Nasıl Ayarlarım? - Google Fan Webmaster Forum
Google Fan Webmaster Forum  

Geri Dön   Google Fan Webmaster Forum > Webmaster Genel > Webmaster Genel konular sorunlar

Webmaster Genel konular sorunlar Webmaster genel konular sorular sorunlar

Cevapla
 
LinkBack Konu Seçenekleri
  #1 (permalink)  
Eski 14-02-2008, 18:18:57
helperman - ait Avatar
 
Sakarya Şubesi
Nerden: İlk Önce Sen Söyle
Yaş: 21
Mesajlar: 1.246
Thanks: 5
Thanked 0 Times in 0 Posts
iTrader Puanı: (1)
iTrader Feedback: (100%)
Rep puanı: 111
helperman isimli üyemiz daha yolun başında.helperman isimli üyemiz daha yolun başında.
helperman - MSN üzerinden Mesaj gönder
Red face Dosya Upload Scriptinde Yüklenecek Dizini Nasıl Ayarlarım?

Merhaba Arkadaşlar

Dosya Upload - Bilgi Upload Deponuz

adında bir dosya upload scripti kurdum. Herşey tamam dosyaları yüklüyebiliyorum linkleri de alabiliyorurm. Fakat yüklenen dosyalar anadizine kaydediliyor. Benim istediği ise anadizin değil d ebir alt klasöre kaydedilmesini istiyorum. Ayarların yapıldığı dosyayı aşağıda size veriyorum. Acaba anadizine değilde alt klasöre yüklemek için ne yapmamız gerekiyor.

Şimdiden ilginiz için teşekkürler

PHP Kodu:
<?php
#####################################################################
# DODOUPLOAD VERSION 1.3                                            #
# Written in PHP                                                    #
# Released on March 03, 2005 under linkware                            #
# Created by Dodo http://pure-essence.net/                            #
# Distributed through http://regretless.com/scripts/                #
# Please link either site if you use this script.                    #
# You may not redistribute this file without my written permission.    #
# Feel free to modify this file to your need.                        #
# Please contact me http://pure-essence.net/domain/contact.php        #
# if you wish to redistribute a modifed version of my script!        #
#                                                                    #
# ENJOY THE SCRIPT!                                                    #
#####################################################################


########### REQUIRED EDITS ########################################
$require_login 1;        // set it to 0, no login will be required
// define below if $require_login is 1
$user "demo";
$pass "test";

########### OPTIONAL EDITS ########################################
$numpage 8// number of files listed per page
$MAX_FILE_SIZE "15000"// in bytes!!
$date_format "m/d/Y g:i a"// visit php.net/date for more info

$bgcolor_alt_array[] = "#0088BB"// first table row bg color
$bgcolor_alt_array[] = "#0077BB"// second table row bg color
// you can add more if you want
//$bgcolor_alt_array[] = ""; // third table row bg color

$textcolor_alt_array[] = "#FFFFFF"// first table row text color
$textcolor_alt_array[] = "#FFFFFF"// second table row text color
// you can add more if you want
//$textcolor_alt_array[] = ""; // third table row text color

// upload files to where your index.php is
$userpath $_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF']);
// or you may define your own
//$userpath = "/home/yourusername/www/tmp/upload/img";
// upload files to where your index.php is
$httppath "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
// or you may define your own
//$httppath = "http://dinlemix.com/11/3/tmp/upload/img";

// if uploaded file is an image, require a certain image dimension?
$dim_requirement null;
//$dim_requirement = array(100, 70); // this means width no bigger than 100 pixels,
                                    // height no bigger than 70 pixels
$require_exact_dim 0// make it to 1 to require the exact dim above
$require_file_type null;    // enter the require file type if necessary
                            // i.e. $require_file_type = "images/gif";
                            // require all uploaded files to be only gif files
$filename_limit 0// set this to a number if you wish to limit the number of
                        // characters in the file name the user uploads

$ignore_files = array(
'index.php',
'header.php',
'footer.php',
'readme.txt',
'error_log',            // feel free to add to the list
);


















###################################### DO NOT EDIT ############################################

header("Cache-Control: no-cache");
// Emular register_globals on
if (!ini_get('register_globals')) {
    
$superglobales = array($_SERVER$_ENV$_FILES$_COOKIE$_POST$_GET);
    if (isset(
$_SESSION)) {
        
array_unshift($superglobales$_SESSION);
    }
    foreach (
$superglobales as $superglobal) {
        
extract($superglobalEXTR_SKIP);
    }
}
if(
$require_login == 1) {
    if(
$do == "logout") {
        
setcookie('dodoupload_user'"");
        
setcookie('dodoupload_pass'"");
        
header("Location: ".$_SERVER['PHP_SELF']);
    } 
    
// is cookie set correctly?
    
if($_COOKIE['dodoupload_user'] == $user && $_COOKIE['dodoupload_pass'] == md5($pass)) {
        
define("DODOUPLOADOK"1);
    } else {
        if(empty(
$do)) {
            include_once(
"header.php");
            
load_login_form();
        } else if(
$do == "login") {
            if(
$_POST['username'] != $user || $_POST['password'] != $pass) {
                include_once(
"header.php");
                
print_error("Error""Invalid username and/or password.");
            } else {
                
setcookie('dodoupload_user'$user);
                
setcookie('dodoupload_pass'md5($pass), time()+31536000);
                
define("DODOUPLOADOK"1);
            }
        }
    }
} else {
    
define("DODOUPLOADOK"1);
// end






include_once("header.php");
// load main switch if constant pass is defined
if(defined("DODOUPLOADOK")) {
    switch(
$action) {
        case 
"uploadmulti_upload":
        case 
"upload":
            
$uploaded_files handle_uploaded_files("userfile");
            if(empty(
$uploaded_files)) {
                
print_error("Error""You didn't upload any file(s).");
            } else {
                
$error uploadfiles_error_checking($uploaded_files$userpath$MAX_FILE_SIZE$dim_requirement$require_exact_dim$filename_limit$require_file_type);
                if(
$error !== true)
                    
print_error("Error"$error);
                else {
                    
$output upload_files($uploaded_files$userpath);
                    
print_error("Success""Following file(s) have been uploaded.<br /><br />".$output"Back Home"$_SERVER['PHP_SELF']);
                    
display_upload_form();
                }

            }
            break;
        case 
"uploadmulti":
            if(
$number <= 0)
                
$number 5;
            
upload_multi_form($number);
            break;
        case 
"edit":
            if(
$delete == null) {
                
print_error("Error""You have not selected any files to delete.""Back Home"$_SERVER['PHP_SELF']);
            } else {
                if(!
$confirm) {
                    echo 
"<h1>Delete Confirmation</h1><br />";
                    echo 
"<form method=post action=\"$_SERVER[PHP_SELF]\">\n<input type=hidden name=action value=edit>\n";
                    echo 
"<div class=\"othertext\">Are you sure you want to delete the following file(s)?<br />\n";
                    echo 
"<ul>\n";
                    foreach(
$delete as $doll) {
                        echo 
"<li><a href=\"$doll\" target=\"_blank\">$doll</a></li>\n";
                        echo 
"<input name=\"delete[]\" value=\"$doll\" type=\"hidden\" />\n";
                    }
                    echo 
"</ul>\n";
                    echo 
"</div><input type=\"submit\" name=\"confirm\" value=\"Yes, I'm sure!\" class=\"bottombutton\" />\n";
                    echo 
"</form>";
                } else {
                    
getrid($delete);
                }
            }
            break;
        default:
            if(!
in_array($sortby, array('name''size''time'))) {
                
$sortby "name";
            }
            if(!
in_array($way, array('ASC''DESC'))) {
                
$way "ASC";
            }
            
$all_files file_reading($userpath);
            
display_upload_form();
            echo 
"<br />\n";
            echo 
"<br />\n";

            if(!
$thispage)
                
$thispage 1;

            
// getting the number of total entries
            
$totalentries count($all_files);

            
$total_pages ceil($totalentries/$numpage);

            
            
$page_string "<div class=\"othertext\">[ ";
            
$page_symbol = ($_SERVER['PHP_SELF'] == $_SERVER['REQUEST_URI']) ? "?" "&";
            
$page_symbol2 = ($page_symbol == "?") ? "\?" $page_symbol;

            
$page_string .= $pagelink page_links($thispage$total_pages$_SERVER[PHP_SELF]."?sortby=$sortby&way=$way&thispage=%d");
            
$page_string .= " ]\n";
            
            if(
$thispage != "showall") {
                
$page_string .= " [ <a href=\"$_SERVER[PHP_SELF]?sortby=$sortby&way=$way&thispage=showall\">Show All</a> ]";
            } else {
                
$page_string .= " [ Show All ]";
            }
            
$page_string .= "</div>"
            
############ displaying #####################

            
            
if($total_pages 1) echo $page_string."<br />";
            
displaypages($thispage$numpage$all_files);
            if(
$total_pages 1) echo "<br />".$page_string;
            
            break;
    } 
// end of switch
}
dodo_rules();
include(
"footer.php");

function 
file_reading($userpath) {
    global 
$ignore_files$sortby$way;
    
$handle opendir($userpath);
    
    
// This while loop is used to sort the array
    
while ($file readdir($handle)) 
    {
        if(
$file != '.' && $file != '..' && $file != $_SERVER['PHP_SELF'] && (is_array($ignore_files) && !in_array($file$ignore_files)) && !is_dir($file))
        {
            
$dolls[] = $file// then add it to the array
            
$dolls_filesize[] = filesize($userpath."/".$file);
            
$dolls_updatetime[] = filemtime($userpath."/".$file);
        }
    }
    if(
$dolls != null) {
        
$dolls sort_correctly($dolls$dolls_filesize$dolls_updatetime);
    }

    
closedir($handle);
    return 
$dolls;
}




function 
sort_correctly($dolls$dolls_filesize$dolls_updatetime) {
    global 
$sortby$way;
    if(
$sortby == "name") {
        if(
$way == "ASC") {
            
            
sort($dolls);
            
reset($dolls);
        } else {
            
rsort($dolls);
            
reset($dolls);
        }
    } elseif(
$sortby == "size") {
        if(
$way == "ASC") {
            
asort($dolls_filesize);
            
reset($dolls_filesize);
            
$right_keys array_keys($dolls_filesize);
        } else {
            
arsort($dolls_filesize);
            
reset($dolls_filesize);
            
$right_keys array_keys($dolls_filesize);
        }
    } elseif(
$sortby == "update") {
        if(
$way == "ASC") {
            
asort($dolls_updatetime);
            
reset($dolls_updatetime);
            
$right_keys array_keys($dolls_updatetime);
        } else {
            
arsort($dolls_updatetime);
            
reset($dolls_updatetime);
            
$right_keys array_keys($dolls_updatetime);
        }
    }

    if(
$right_keys != null) {
        
$new_dolls = array();
        foreach(
$right_keys as $thekey) {
            
$new_dolls[] = $dolls[$thekey];
        }
        
$dolls = array();
        
$dolls $new_dolls;
    }
    return 
$dolls;
}


function 
displaypages($thispage$numpage$dolls) {
    global 
$bgcolor_alt_array$textcolor_alt_array$date_format$sortby$way$userpath$httppath;

    
$size_sort_text_link "Size(kb)";
    
$time_sort_text_link "Last updated";
    
$name_sort_text_link "Files";

    if(
$sortby == "name") {
        if(
$way == "ASC") {
            
$name_sort_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=DESC\" title=\"Sort by Name Descendingly!\" ><img src=\"images/desc_order.gif\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Name Descendingly!\" /></a>";
        } else {
            
$name_sort_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=ASC\" title=\"Sort by Name Ascendingly!\" ><img src=\"images/asc_order.gif\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Name Ascendingly!\" /></a>";
        }
        
$size_sort_text_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=size&way=ASC\" title=\"Sort by Size Ascendingly!\">Size(kb)</a>";
        
$time_sort_text_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=time&way=ASC\" title=\"Sort by Last Update Time Ascendingly!\">Last updated</a>";
    } elseif(
$sortby == "size") {
        if(
$way == "ASC") {
            
$size_sort_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=DESC\" title=\"Sort by Size Descendingly!\" ><img src=\"images/desc_order.gif\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Size Descendingly!\" /></a>";
        } else {
            
$size_sort_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=ASC\" title=\"Sort by Size Ascendingly!\" ><img src=\"images/asc_order.gif\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Size Ascendingly!\" /></a>";
        }
        
$name_sort_text_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=name&way=ASC\" title=\"Sort by Name Ascendingly!\">Files</a>";
        
$time_sort_text_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=time&way=ASC\" title=\"Sort by Last Update Time Ascendingly!\">Last updated</a>";
    } elseif(
$sortby == "time") {
        if(
$way == "ASC") {
            
$time_sort_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=DESC\" title=\"Sort by Last Update Time Descendingly!\" ><img src=\"images/desc_order.gif\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Last Update Time Descendingly!\" /></a>";
        } else {
            
$time_sort_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=$sortby&way=ASC\" title=\"Sort by Last Update Time Ascendingly!\" ><img src=\"images/asc_order.gif\" width=\"11\" height=\"10\" border=\"0\" alt=\"Sort by Last Update Time Ascendingly!\" /></a>";
        }
        
$name_sort_text_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=name&way=ASC\" title=\"Sort by Name Ascendingly!\">Files</a>";
        
$size_sort_text_link "<a href=\"$_SERVER[PHP_SELF]?thispage=$thispage&sortby=size&way=ASC\" title=\"Sort by Size Ascendingly!\">Size(kb)</a>";
    }


    echo 
"<form method=post action=\"$_SERVER[PHP_SELF]\">\n<input type=hidden name=action value=edit>\n";
    echo 
"<table width=\"500\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" align=\"center\" class=\"table\"  id=\"ID1\">";
    echo 
"<tr><td width=\"5%\" class=\"tableheader\"></td>\n";
    echo 
"<td align=\"center\" width=\"25%\" class=\"tableheader formtext\">$name_sort_text_link $name_sort_link</td>\n";
    echo 
"<td align=\"center\" width=\"20%\" class=\"tableheader formtext\">$size_sort_text_link $size_sort_link</td>\n";
    echo 
"<td align=\"center\" width=\"45%\" class=\"tableheader formtext\">$time_sort_text_link $time_sort_link</td>\n";
    echo 
"<td align=\"center\" width=\"5%\" class=\"tableheader\"><input type=checkbox value=\"CheckAll\" onClick=\"doCheckAll('ID1')\" id=\"CID1\" name=\"CID1\"></td></tr>\n";


    if(
$thispage == "showall") {
        for (
$entry 0$entry count($dolls); $entry++) {

            
// if the array element is empty, break out of the for loop
            
if($dolls[$entry] == "")
                break;
            
$colornum++;

            
$total_colors count($bgcolor_alt_array);
            
// the bgcolor is figured out by the remainder of
            // the row number divide by the total number of colors

            
$remainder $entry $total_colors;

            
// whatever the value is
            
$bgcolor $bgcolor_alt_array[$remainder];
            
$textcolor $textcolor_alt_array[$remainder];

            
$index $entry+1;


            
// Varible for file size
            
$filesize  filesize($userpath."/".$dolls[$entry])/1000;    
            
$filesizek number_format($filesize2);

            
// Variables for the time output
            
$last_updated1 filemtime($userpath."/".$dolls[$entry]);
            
$last_updated  date($date_format,$last_updated1);


            
$dolls[$entry] = stripslashes($dolls[$entry]);
            echo 
"<tr>\n";
            
mini_template($index$textcolor$bgcolor);
            
mini_template("<a href=\"$httppath/$dolls[$entry]\" target=\"_blank\"><span style=\"color: $textcolor\">$dolls[$entry]</span></a>"$textcolor$bgcolor);
            
mini_template($filesizek$textcolor$bgcolor);
            
mini_template($last_updated$textcolor$bgcolor);
            
mini_template("<input type=checkbox name=delete[$entry] value=\"".$dolls[$entry]."\">"$textcolor$bgcolor);
            echo 
"</tr>\n";
            
        }
    } else {

        for (
$j 0$j $numpage$j++) {
            
$entry = ($thispage-1)*$numpage+$j;
            
// if the array element is empty, break out of the for loop
            
if($dolls[$entry] == "")
                break;
            
$colornum++;

            
$total_colors count($bgcolor_alt_array);
            
// the bgcolor is figured out by the remainder of
            // the row number divide by the total number of colors

            
$remainder $entry $total_colors;

            
// whatever the value is
            
$bgcolor $bgcolor_alt_array[$remainder];
            
$textcolor $textcolor_alt_array[$remainder];

            
$index $entry+1;


            
// Varible for file size
            
$filesize  filesize($userpath."/".$dolls[$entry])/1000;    
            
$filesizek number_format($filesize2);

            
// Variables for the time output
            
$last_updated1 filemtime($userpath."/".$dolls[$entry]);
            
$last_updated  date($date_format,$last_updated1);


            
$dolls[$entry] = stripslashes($dolls[$entry]);
            echo 
"<tr>\n";
            
mini_template($index$textcolor$bgcolor);
            
mini_template("<a href=\"$httppath/$dolls[$entry]\" target=\"_blank\"><span style=\"color: $textcolor\">$dolls[$entry]</span></a>"$textcolor$bgcolor);
            
mini_template($filesizek$textcolor$bgcolor);
            
mini_template($last_updated$textcolor$bgcolor);
            
mini_template("<input type=checkbox name=delete[$entry] value=\"".$dolls[$entry]."\">"$textcolor$bgcolor);
            echo 
"</tr>\n";
            
        }
    } 
// end of else if it's not show all

    
    
echo "</table>\n";
    echo 
"<table width=\"500\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" align=\"center\">";
    echo 
"<tr><td align=\"center\"><input type=submit value=\"Delete Checked\" class=\"bottombutton\"></td></tr></table></form>";

// end of the function




function mini_template($text$textcolor$bgcolor) {
    echo 
"<td align=\"center\" bgcolor=\"$bgcolor\" class=\"othertext\" style=\"color: $textcolor\">$text</td>\n";
}



function 
display_upload_form() {
    global 
$MAX_FILE_SIZE$require_login;
    
// display upload html

    
echo "<br />\n";
    echo 
"<table cellspacing=5 align=\"center\">\n";
    echo 
"<tr>\n";
    echo 
"<td>\n";
    if(
$require_login == 1)
        
$logout " -- <a href=\"".$_SERVER['PHP_SELF']."?do=logout\">Logout</a>";

    echo 
"<h1>Upload File: (Under ".$MAX_FILE_SIZE." Bytes) ".$logout."</h1>\n";
    echo 
"<form enctype=\"multipart/form-data\" action=\"".$_SERVER['PHP_SELF']."?action=upload\" method=\"post\">\n";
    echo 
"<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"".$MAX_FILE_SIZE."\" />\n";
    echo 
"<input name=\"userfile[]\" TYPE=\"file\" class=\"input\" size=\"60\"><BR>\n";
    echo 
"<input type=\"submit\" VALUE=\"Send File\" class=\"bottombutton\"> <span class=\"othertext\"><input name=\"overwrite_me[]\" value=\"1\" type=\"checkbox\"> Overwrite old file? <a href=\"".$_SERVER['PHP_SELF']."?action=uploadmulti\">Upload multiple files at once</a></span>\n";
    echo 
"</form>\n";
    echo 
"</td>\n";
    echo 
"</tr>\n";
    echo 
"</table>\n";


// end of function display_upload_form




function upload_multi_form($number) {
    global 
$bgcolor_alt_array$textcolor_alt_array$MAX_FILE_SIZE;
    echo 
"<form ENCTYPE=\"multipart/form-data\" action=\"".$_SERVER['PHP_SELF']."?action=uploadmulti_upload\" method=\"post\"><br />\n";
    echo 
"<p>Upload $number files. All files should be under $MAX_FILE_SIZE bytes.<br />\n";
    echo 
"Check the checkboxes to indicate that you wish to overwrite the old file(s).</p>\n";
    echo 
"<table align=\"center\" width=\"500\" cellpadding=\"5\" cellspacing=\"1\" border=\"0\" class=\"table\"  id=\"ID1\">\n";
    echo 
"<tr>\n";
    echo 
"<td class=\"tableheader\" width=\"1\" align=\"center\"><input type=checkbox value=\"CheckAll\" onClick=\"doCheckAll('ID1')\" id=\"CID1\" name=\"CID1\"></td>\n";
    echo 
"<td class=\"tableheader\"><b>Upload</b> <input id=\"n\" name=\"number\" value=\"".$number."\" size=\"2\" maxlength=\"2\"> files \n";
    echo 
"<a href=\"#\" onclick=\"window.location='".$_SERVER['PHP_SELF']."?action=uploadmulti&number='+document.getElementById('n').value\">go!</a>\n";
    
//echo "<a href=\"#\" onclick=\"window.location='index.php'\">go!</a>\n";
    
echo "</td>\n";
    echo 
"</tr>\n";
    for(
$i 1$i <= $number$i++) {

        
$j str_pad($i2"0"STR_PAD_LEFT);
        
$l $i 1;

        
        
$total_colors count($bgcolor_alt_array);
        
// the bgcolor is figured out by the remainder of
        // the row number divide by the total number of colors

        
$remainder $i $total_colors;

        
// whatever the value is
        
$bgcolor $bgcolor_alt_array[$remainder];
        
$textcolor $textcolor_alt_array[$remainder];
        
        echo 
"<tr>\n";
        echo 
"<td class=\"othertext\" bgcolor=\"".$bgcolor."\"><input type=\"checkbox\" name=\"overwrite_me[".$l."]\" value=\"1\"></td>\n";
        echo 
"<td class=\"othertext\" bgcolor=\"".$bgcolor."\" style=\"color: ".$textcolor.";\">File #".$j.": <input type=\"file\" name=\"userfile[".$l."]\" class=\"input\" size=\"48\" /></td>\n";
        echo 
"</tr>\n";
    }
    echo 
"</table>\n";

    echo 
"<p align=\"center\"><INPUT TYPE=\"submit\" VALUE=\"Send Files\" class=\"bottombutton\"></p></form>\n";
}



function 
figure_new_name($file_name$abspath) {
    
$name explode("."$file_name);

    if(
is_file($abspath."/".$file_name)) {
        
$i 1;
        while(
is_file($abspath."/".$name[0].$i.".".$name[1])) {
            
$i++;
        }
        return 
$name[0].$i.".".$name[1];
    }
    return 
$file_name;
}





function upload_files($uploaded_files$abspath) {
    global 
$httppath;
    
$output "";
    for(
$i 0$i count($uploaded_files[name]); $i++) {
        
$file_name $uploaded_files[name][$i];
        
$file_overwrite $uploaded_files[overwrite_me][$i];
        
$file_tmp_name $uploaded_files[tmp_name][$i];
        if(
$file_overwrite != 1)
            
$file_name figure_new_name($file_name$abspath);
        
move_uploaded_file ($file_tmp_name$abspath."/".$file_name);
        
$output .= "<a href=\"".$httppath."/".$file_name."\" target=\"_blank\">".$httppath."/".$file_name."</a><br />\n";
    }
    return 
$output;
}




function 
handle_uploaded_files($array_name) {
    global $
$array_name$_FILES;
    
$newpoop null;
    
$index 0;
    
$total count($_FILES[$array_name][name]);

    for(
$i 0$i $total$i++) {
        if(isset(
$_FILES[$array_name][error][$i]) && $_FILES[$array_name][error][$i] != 4) {
            
$newpoop[name][$