Parašė ozzWANTED· 2009 Sau. 2 18:01:23
#5
Kad nesiskųstų kai kurie žmonės kad nepadedu, tai vat parašiau šiokį tokį koduką spec. for u be jokio atlygio :):
Tiesiog reikia img prieš keliant paversti kodu:
<a href='".FUSION_SELF."?getfile=".$data['photo_id']."'>GAUTI</a>
Gavimo kodas:
if ((isset($_GET['getfile']) && isNum($_GET['getfile']))) {
require_once INCLUDES."class.httpdownload.php";
$result = dbquery("SELECT * FROM {$db_prefix}file_photos WHERE photo_id='".$_GET['getfile']."'");
$data = dbarray($result);
ob_end_clean();
$object = new httpdownload;
$object->set_bydata(stripslashes($data['image_source']));
$object->use_resume = true;
$object->set_filename($data['image_filename']);
$object->set_mime("text/plain");
$object->download();
exit;
}
Uploadinimo kodas:
if (isset($_FILES['upload']['name']) && $_FILES['upload']['name'] != "" && is_uploaded_file($_FILES['upload']['tmp_name'])) {
$temp = fopen($_FILES['upload']['tmp_name'],"r");
$filename = stripinput($_FILES['upload']['name']);
$source = addslash(addslash(fread($temp, filesize($_FILES['upload']['tmp_name']))));
fclose($temp);
unlink($_FILES['upload']['tmp_name']);
$result = dbquery("INSERT INTO {$db_prefix}file_photos (image_source, image_filename) VALUES ('$filename', '$source')");
}