Multiple,file,uploader,in,php,upload

Yavuz 9/20/2016 0

Multiple file uploader in PHP

PHP
<?php 

$maxsize = "200000"; 
$path = "/full/path/to/my/directory/"; 

if($uploads <= 1) 
{ 
    $uploads = 5; 
} 
$fields = $uploads   $uploads; 

for($n = 0; $n < $uploads; $n  ) 
{ 
    if($uploadedFile[$n] != "" && $uploadedFile[$n] != "none") 
    { 
    copy("$uploadedFile[$n]", "$path$uploadedFile_name[$n]"); 
    rename("$path$uploadedFile_name[$n]", "$path$fileName[$n]"); 
    if(file_exists("$path$fileName[$n]")) 
    { 
        print("upload successful for $fileName[$n] - $uploadedFile_size[$n] bytes<br>\n"); 
    } 
    else 
    { 
        print("error: upload failed<br>\n"); 
    } 
    } 
} 

print("<form action=\"$PHP_SELF\" method=\"POST\" enctype=\"multipart/form-data\">\n"); 
print("<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$maxsize\">\n"); 
print("<table border=\"0\" cellpadding=\"0\" cellspacing=\"3\"><tr><td>\n"); 
print("<b>Name:</b></td><td>\n"); 
print("<b>File Location:</b></td></tr>\n"); 

for($i = 1; $i <= $uploads; $i  ) 
{ 
    print("<tr><td><input type=\"text\" name=\"fileName[]\" value=\"example$i.jpg\" size=\"13\"></td><td>\n"); 
    print("<input type=\"file\" name=\"uploadedFile[]\" size=\"25\"></td></tr>\n"); 
} 

print("<tr><td align=\"center\"><input type=\"submit\" value=\"UPLOAD\"></td><td>\n"); 
print("<a href=\"$PHP_SELF?uploads=$fields\">More Upload Fields</a></td></tr>"); 
print("</table>\n"); 
print("</form>\n"); 

?>
 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments