PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Muharrem ERIN  >  KG Uploader Class  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Uploader Class Test File
Class: KG Uploader Class
Manage multiple files uploaded with Web forms
Author: By
Last change:
Date: 7 years ago
Size: 2,498 bytes
 

Contents

Class file image Download
<?PHP
header
("Content-Type: text/html; charset=utf-8");
require_once(
'kgUploader.class.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>KG Uploader v1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
    body {
        margin:20px; background:#f2f2f2; font:0.8em/1.8em arial, helvetica, sans serif; color:#333;
    }
    form {
        margin:0;
    }
    #reports {
        margin:auto; width:300px; padding:3px; background:#fff; border:1px solid #e0e0e0;
    }
    #reports ul {
        list-style-type:square;
    }
    #reports ul li {
        border-bottom:1px dotted #e0e0e0;
    }
    #form {
        margin:auto; width:300px; padding:3px; margin-top:3px; background:#fff; border:1px solid #e0e0e0;
    }
</style>
</head>
<body>

<?PHP
if($_FILES) {
?>
<div id="reports">
<?PHP
    $mime_types
= array('image/pjpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/x-png', 'application/x-tar', 'application/zip', 'application/msword', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/mspowerpoint', 'application/x-shockwave-flash', 'text/plain', 'text/richtext', 'application/pdf'); // izin verilecek olan dosya tipleri
   
$kgUploaderOBJ = & new kg_uploader();
   
$kgUploaderOBJ -> uploader_set($_FILES['dosyalar'], './repo', $mime_types); // 1. parametre FILES dizisi, 2. parametre dizin, 3. parametre ise izin verilen dosya tipleri
   
$kgUploaderOBJ -> result_report(); // yukleme ayrintilarini gosterir
    /* //Eğer dosya isimleri bir tabloya kaydedilmek istenirse asagidaki gibi listeletilebilir.
    for ($i = 0; $i < count($kgUploaderOBJ -> uploaded_files); $i++) {
        echo $kgUploaderOBJ -> uploaded_files[$i];
    }
    */
?>
</div>
<?PHP
}
?>

<div id="form">
    <form method="post" action="test.php" enctype="multipart/form-data">
        <p><input type="file" name="dosyalar[]" id="dosya1" /></p>
        <p><input type="file" name="dosyalar[]" id="dosya2" /></p>
        <p><input type="file" name="dosyalar[]" id="dosya3" /></p>
        <p><input type="file" name="dosyalar[]" id="dosya4" /></p>
        <p><input type="file" name="dosyalar[]" id="dosya5" /></p>
        <p><input type="submit" name="upload" value="Yükle" id="upload" /></p>
    </form>
</div>

</body>
</html>