Örnek
Deneme.html
<html>
<head>
<title>Upload</title>
</head>
<body>
<center>
<h2>Upload</h2>
<form name="upload" action="upload.php" method="post" enctype="multipart/form-data">
Choose File:
<input type="file" name="file">
<br><br>
<input type="submit" name="upload" value="Send">
</form>
</center>
</body>
</html><?
// upload.php
// by EJDER (www.ejder.com.tr)
include "upload.inc.php";
// Defining Class
// Sınıfı Tanımlıyoruz
$yukle = new upload;
// Set Max Size
// Yüklenecek en büyük dosya boyutunu ayarlıyoruz
$yukle->set_max_size(180000);
// Set Directory
// Yüklenecek dizini ayarlıyoruz, bu dizin 0666 veya 0777 CHMOD ile ayarlanmalı
$yukle->set_directory("data");
// Do not change
// Set Temp Name for upload, $_FILES['file']['tmp_name'] is automaticly get the temp name
// Değiştirmeyin
// Geçici yükleme dosyasını ayarlar, $_FILES['file']['tmp_name'] otomatik olarak bu ismi alır
$yukle->set_tmp_name($_FILES['file']['tmp_name']);
// Do not change
// Set file size, $_FILES['file']['size'] is automaticly get the size
// Değiştirmeyin
// Dosya boyutunu ayarlayın, $_FILES['file']['size'] otomatik olarak dosya boyutunu alır
$yukle->set_file_size($_FILES['file']['size']);
// Do not change
// Set File Type, $_FILES['file']['type'] is automaticly get the type
// Değiştirmeyin
// Dosya tipini ayarlayın, $_FILES['file']['type'] otomatik olarak dosya tipini alır
$yukle->set_file_type($_FILES['file']['type']);
// Set File Name, $_FILES['file']['name'] is automaticly get the file name.. you can change
// Dosya adını ayarla, $_FILES['file']['name'] otomatik olarak dosyanın ismini alır, istediğiniz başka bir isim verebilirsiniz
$yukle->set_file_name($_FILES['file']['name']);
// Start Copy Process
// Kopyalama işlemini başlat
$yukle->start_copy();
// If uploaded file is image, you can resize the image width and height
// Support gif, jpg, png
// Eğer yüklenen dosya resim ise boyutunu ayarlayabilirsiniz..
// Gif, jpg ve png desteklidir
// genişlik, yükseklik şeklindedir, sadece birini yazar diğerine 0 yazarsanız otomatik olarak onu ayarlar
$yukle->resize(0,0);
// Control File is uploaded or not
// If there is error write the error message
// Yüklenen dosyayı kontrol et, eğer hata varsa hata mesajını yaz
if($yukle->is_ok())
echo "Yüklendi";
else
echo $yukle->error()."<br>";
// Set a thumbnail name
// Kopyasının adını ayarla
$yukle->set_thumbnail_name("hatice");
// create thumbnail
// Kopya oluştur
$yukle->create_thumbnail();
// change thumbnail size
// Kopyanın boyutunu değiştir
$yukle->set_thumbnail_size(0, 250);
$yukle->set_thumbnail_name("hatice2");
$yukle->create_thumbnail();
$yukle->set_thumbnail_size(50, 0);
$yukle->set_thumbnail_name("hatice3");
$yukle->create_thumbnail();
$yukle->set_thumbnail_size(62, 150);
?>