Extezija filea

pozdrav
pravim neku stranicu sa fotovima skinu sam neku skriptu koja more samo uplodat ttf file a ima dosta otf fajlova moze li tko dodati otf file

else {
// get first font name
$directory = “…/”.$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != ‘.’ && $file != ‘…’) {
$tempexp = explode(".", $file);
$final = COUNT($tempexp)-1;
$extension = strtolower($tempexp[$final]);
if($extension == “ttf”) {
$filesize = filesize($directory.$file);
$filesize = $filesize/2024;
$filesize = round($filesize, 1);
$fontname = $file;
}
}
}

else {
// get first font name
$directory = “…/”.$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != ‘.’ && $file != ‘…’) {
$tempexp = explode(".", $file);
$final = COUNT($tempexp)-1;
$extension = strtolower($tempexp[$final]);
if($extension == “ttf”,“otf”) {
$filesize = filesize($directory.$file);
$filesize = $filesize/2024;
$filesize = round($filesize, 1);
$fontname = $file;
}
}
}

Valjda tako radi

[quote=“eldžo”]else {
// get first font name
$directory = “…/”.$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != ‘.’ && $file != ‘…’) {
$tempexp = explode(".", $file);
$final = COUNT($tempexp)-1;
$extension = strtolower($tempexp[$final]);
if($extension == “ttf”,“otf”) {
$filesize = filesize($directory.$file);
$filesize = $filesize/2024;
$filesize = round($filesize, 1);
$fontname = $file;
}
}
}

Valjda tako radi[/quote]
moram priznat da ovakvu formu if-a nisam još vidio :smiley:
Ja bi uglavnom to ovako napravio

// get first font name
$directory = "../".$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != '.' && $file != '..') {
$tempexp = explode(".", $file);
$final = COUNT($tempexp)-1;
$extension = strtolower($tempexp[$final]);
$allowedExtensions=array("ttf","otf"); //možeš dodati i ostale extenzije po želji...
if(in_array($extension,$allowedExtensions)) {
$filesize = filesize($directory.$file);
$filesize = $filesize/2024;
$filesize = round($filesize, 1);
$fontname = $file;
}
}
} 

a možeš i da opće ne provjeravaš extenzije, da prikazuješ sve extenzije

// get first font name
$directory = "../".$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != '.' && $file != '..') {
$filesize = filesize($directory.$file);
$filesize = $filesize/2024;
$filesize = round($filesize, 1);
$fontname = $file;

}
}

ali još jedna stvar, ovaj kod ti nema veze s uploadanjem lol, ovo je prije izlistavanje direktorija

neće

ovo je cijeli file

<?php

include_once("…/config.inc.php");
include_once("…/function-library.php");
include_once("…/db_connect.php");

$ptitle = “Admin Area - Add New Font”;
include_once(“header.php”);

$submitme = $_REQUEST[‘submitme’];
$f_font_name = $_REQUEST[‘f_font_name’];

if(isset($submitme)) {

$errorstring = “”;

if(strlen($f_font_name) == 0) $errorstring = “Please tell us the title of the font.
”;

if(strlen($errorstring) == 0) {

function storefile($var, $location, $filename=NULL, $maxfilesize=NULL) {
$ok = false;

// Check file
$mime = $_FILES[$var][“type”];
if(($mime==“application/zip”) || ($mime == “application/x-zip-compressed”) || ($mime == “multipart/x-zip”) || ($mime == “application/x-gzip”)) {
// Mime type is correct
// Check extension
$name = $_FILES[$var][“name”];
$array = explode(".", $name);
$nr = count($array);
$ext = $array[$nr-1];
if($ext==“zip”) {
$ok = true;
}
}

if(isset($maxfilesize)) {
if($_FILES[$var][“size”] > $maxfilesize) {
$ok = false;
}
}

if($ok==true) {
$tempname = $_FILES[$var][‘tmp_name’];
if(isset($filename)) {
$uploadpath = $location.$filename;
} else {
$uploadpath = $location.$_FILES[$var][‘name’];
}
if(is_uploaded_file($_FILES[$var][‘tmp_name’])) {
while(move_uploaded_file($tempname, $uploadpath)) {
// Wait for the script to finish its upload
}
}
return true;
} else {
return false;
}
}

$insert_new = mysql_query(“INSERT INTO tblfonts (name) VALUES (’”.escape_string($f_font_name)."’)");
$last_insert = mysql_insert_id();

if($insert_new) {
$newfilename = $last_insert.".zip";
if(storefile(“f_file”, “…/”.$font_originals_path, $newfilename)) {
// if done, extract and update db
include(’…/includes/pclzip.lib.php’);
$archive = new PclZip("…/".$font_originals_path.$newfilename);
if ($archive->extract("…/".$font_contents_path.$last_insert."/", $last_insert) == 0)
{
//failed
$delete = mysql_query(“DELETE FROM tblfonts WHERE id=”.$last_insert);
$errorstring = “Upload failed, please try again later.
”;
}
else {
// get first font name
$directory = “…/”.$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != ‘.’ && $file != ‘…’) {
$tempexp = explode(".", $file);
$final = COUNT($tempexp)-1;
$extension = strtolower($tempexp[$final]);
if($extension == “ttf”) {
$filesize = filesize($directory.$file);
$filesize = $filesize/1024;
$filesize = round($filesize, 1);
$fontname = $file;
}
}
}
$update = mysql_query(“UPDATE tblfonts SET fontfilename = '”.$fontname."’, filesize = “.$filesize.” WHERE id = “.$last_insert.” LIMIT 1");
$errorstring = "Upload succeeded!

";
}
}
else {
$delete = mysql_query(“DELETE FROM tblfonts WHERE id=”.$last_insert);
$errorstring = “Upload failed, please try again later.
”;
}

}
}

}

?>

Use this form to upload a new font to the site. The upload must be a zip file with the ttf inside or it will be declined.
<?php echo $errorstring; ?>
Font Name:
Upload Font File

-3D

-Army-Stencil

-Asian

-Bitmap-Pixel

-Blackletter

-Brush

-Calligraphy

-Cartoon

-Celtic

-Comic

-Computer

-Curly

-Decorative

-Dingbat

-Modern

-Music

-Old English

-Old School

-Outline

-Retro

-Rock-Stone

-Rounded

-Sci Fi

-Typewriter

-Western

 

-Display

-Distorted

-Dotted

-Famous

-Fire

-Gothic

-Graffiti

-Grunge

-Handwriting

-Headline

-Horror

-Ice-Snow

-Italic

-LCD

-Medieval

<?php include("footer.php"); ?>

<?php

include_once("…/config.inc.php");
include_once("…/function-library.php");
include_once("…/db_connect.php");

$ptitle = “Admin Area - Add New Font”;
include_once(“header.php”);

$submitme = $_REQUEST[‘submitme’];
$f_font_name = $_REQUEST[‘f_font_name’];

if(isset($submitme)) {

$errorstring = “”;

if(strlen($f_font_name) == 0) $errorstring = “Please tell us the title of the font.
”;

if(strlen($errorstring) == 0) {

function storefile($var, $location, $filename=NULL, $maxfilesize=NULL) {
$ok = false;

// Check file
$mime = $_FILES[$var][“type”];
if(($mime==“application/zip”) || ($mime == “application/x-zip-compressed”) || ($mime == “multipart/x-zip”) || ($mime == “application/x-gzip”)) {
// Mime type is correct
// Check extension
$name = $_FILES[$var][“name”];
$array = explode(".", $name);
$nr = count($array);
$ext = $array[$nr-1];
if($ext==“zip”) {
$ok = true;
}
}

if(isset($maxfilesize)) {
if($_FILES[$var][“size”] > $maxfilesize) {
$ok = false;
}
}

if($ok==true) {
$tempname = $_FILES[$var][‘tmp_name’];
if(isset($filename)) {
$uploadpath = $location.$filename;
} else {
$uploadpath = $location.$_FILES[$var][‘name’];
}
if(is_uploaded_file($_FILES[$var][‘tmp_name’])) {
while(move_uploaded_file($tempname, $uploadpath)) {
// Wait for the script to finish its upload
}
}
return true;
} else {
return false;
}
}

$insert_new = mysql_query(“INSERT INTO tblfonts (name) VALUES (’”.escape_string($f_font_name)."’)");
$last_insert = mysql_insert_id();

if($insert_new) {
$newfilename = $last_insert.".zip";
if(storefile(“f_file”, “…/”.$font_originals_path, $newfilename)) {
// if done, extract and update db
include(’…/includes/pclzip.lib.php’);
$archive = new PclZip("…/".$font_originals_path.$newfilename);
if ($archive->extract("…/".$font_contents_path.$last_insert."/", $last_insert) == 0)
{
//failed
$delete = mysql_query(“DELETE FROM tblfonts WHERE id=”.$last_insert);
$errorstring = “Upload failed, please try again later.
”;
}
else {
// get first font name
$directory = “…/”.$font_contents_path.$last_insert."/";
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != ‘.’ && $file != ‘…’) {
$tempexp = explode(".", $file);
$final = COUNT($tempexp)-1;
$extension = strtolower($tempexp[$final]);
if($extension == “ttf”) {
$filesize = filesize($directory.$file);
$filesize = $filesize/1024;
$filesize = round($filesize, 1);
$fontname = $file;
}
}
}
$update = mysql_query(“UPDATE tblfonts SET fontfilename = '”.$fontname."’, filesize = “.$filesize.” WHERE id = “.$last_insert.” LIMIT 1");
$errorstring = "Upload succeeded!

";
}
}
else {
$delete = mysql_query(“DELETE FROM tblfonts WHERE id=”.$last_insert);
$errorstring = “Upload failed, please try again later.
”;
}

}
}

}

?>

Use this form to upload a new font to the site. The upload must be a zip file with the ttf inside or it will be declined.
<?php echo $errorstring; ?>
Font Name:
Upload Font File

-3D

-Army-Stencil

-Asian

-Bitmap-Pixel

-Blackletter

-Brush

-Calligraphy

-Cartoon

-Celtic

-Comic

-Computer

-Curly

-Decorative

-Dingbat

-Modern

-Music

-Old English

-Old School

-Outline

-Retro

-Rock-Stone

-Rounded

-Sci Fi

-Typewriter

-Western

 

-Display

-Distorted

-Dotted

-Famous

-Fire

-Gothic

-Graffiti

-Grunge

-Handwriting

-Headline

-Horror

-Ice-Snow

-Italic

-LCD

-Medieval

<?php include("footer.php"); ?>

proba sam

“ttf”,“otf” čita prvu exteziju isto i sa “ttf,otf”

<?php include_once("../config.inc.php"); include_once("../function-library.php"); include_once("../db_connect.php"); $ptitle = "Admin Area - Add New Font"; include_once("header.php"); $submitme = $_REQUEST['submitme']; $f_font_name = $_REQUEST['f_font_name']; if(isset($submitme)) { $errorstring = ""; if(strlen($f_font_name) == 0) $errorstring = "Please tell us the title of the font. "; if(strlen($errorstring) == 0) { function storefile($var, $location, $filename=NULL, $maxfilesize=NULL) { $ok = false; // Check file $mime = $_FILES[$var]["type"]; if(($mime=="application/zip") || ($mime == "application/x-zip-compressed") || ($mime == "multipart/x-zip") || ($mime == "application/x-gzip")) { // Mime type is correct // Check extension $name = $_FILES[$var]["name"]; $array = explode(".", $name); $nr = count($array); $ext = $array[$nr-1]; if($ext=="zip") { $ok = true; } } if(isset($maxfilesize)) { if($_FILES[$var]["size"] > $maxfilesize) { $ok = false; } } if($ok==true) { $tempname = $_FILES[$var]['tmp_name']; if(isset($filename)) { $uploadpath = $location.$filename; } else { $uploadpath = $location.$_FILES[$var]['name']; } if(is_uploaded_file($_FILES[$var]['tmp_name'])) { while(move_uploaded_file($tempname, $uploadpath)) { // Wait for the script to finish its upload } } return true; } else { return false; } } $insert_new = mysql_query("INSERT INTO tblfonts (name) VALUES ('".escape_string($f_font_name)."')"); $last_insert = mysql_insert_id(); if($insert_new) { $newfilename = $last_insert.".zip"; if(storefile("f_file", "../".$font_originals_path, $newfilename)) { // if done, extract and update db include('../includes/pclzip.lib.php'); $archive = new PclZip("../".$font_originals_path.$newfilename); if ($archive->extract("../".$font_contents_path.$last_insert."/", $last_insert) == 0) { //failed $delete = mysql_query("DELETE FROM tblfonts WHERE id=".$last_insert); $errorstring = "Upload failed, please try again later. "; } else { // get first font name $directory = "../".$font_contents_path.$last_insert."/"; $handler = opendir($directory); while ($file = readdir($handler)) { if ($file != '.' && $file != '..') { $tempexp = explode(".", $file); $final = COUNT($tempexp)-1; $extension = strtolower($tempexp[$final]); if($extension == "ttf") { $filesize = filesize($directory.$file); $filesize = $filesize/1024; $filesize = round($filesize, 1); $fontname = $file; } } } $update = mysql_query("UPDATE tblfonts SET fontfilename = '".$fontname."', filesize = ".$filesize." WHERE id = ".$last_insert." LIMIT 1"); $errorstring = "Upload succeeded! "; } } else { $delete = mysql_query("DELETE FROM tblfonts WHERE id=".$last_insert); $errorstring = "Upload failed, please try again later. "; } } } } ?>
Use this form to upload a new font to the site. The upload must be a zip file with the ttf inside or it will be declined.
<?php echo $errorstring; ?>
Font Name:
Upload Font File

-3D

-Army-Stencil

-Asian

-Bitmap-Pixel

-Blackletter

-Brush

-Calligraphy

-Cartoon

-Celtic

-Comic

-Computer

-Curly

-Decorative

-Dingbat

-Modern

-Music

-Old English

-Old School

-Outline

-Retro

-Rock-Stone

-Rounded

-Sci Fi

-Typewriter

-Western

 

-Display

-Distorted

-Dotted

-Famous

-Fire

-Gothic

-Graffiti

-Grunge

-Handwriting

-Headline

-Horror

-Ice-Snow

-Italic

-LCD

-Medieval

<?php include("footer.php"); ?>

ma nevjerojatno:
dođeš tu tražiš da ti netko napravi posao, nemaš pojma uopće ni o čemu se u skripti radi, ne koristiš code tagove, naslov ti je fenomenalan, svaki forum bi te poželio!
ono malo volje što imam za pomoći gubim radi ovakvih genijalaca, koji hoće da im neko uradi nekakav posao, a ne znaju ni thread postavit

ja dođem tu… ja sam tu svaki dan 24h nu ne moj ako ti je teško šta ja tražim red koda ti to nazivaš poslom.

Nitko ne može znati što ti tražiš, jer ti ne znaš postaviti pitanje.
Što se tiče posla, dal je linija il dvije opće nije bitno, neko je proveo mjesece i godine u tom zanatu da bi to znao napraviti, i kakva korist za ikoga što će ti riješiti to? Ti ionako nećeš ništa naučiti, dobit ćeš samo uslugu koju nikada nigdje nećeš vratiti, ne jer ne možeš, nego jer si lijen i želiš sve servirano od drugih, uz što manje svojeg truda. Tako to neide

Pa Kecko, mogao si mu slobodno reci da ces mu to napraviti za protuuslugu, ako prihvati prihvati ako ne nek mu je ravna cesta.

nu bolan ja ne znam ovo riješti dali sam pokušao jesam
ako mi moreš pomoć pomozi
ako ne znaš,ne moreš ili nećeš hvala ti svedno
Ružno je nekome reći da je lijen ako ne poznaješ osobu

[quote=“kromaser”]
Ružno je nekome reći da je lijen ako ne poznaješ osobu[/quote]U pravu si, a često se iz rješenog primjera nauči za daljnje korištenje. Ne zamaraj se svakakvim atributima koje dobiješ po forumima. Na njima ima svakakvih čudnih likova. Meni su na raznim forumima rekli da sam kreten, lopov, gotovan, lud… nemogu se ni sititi svega. I baš me briga!


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Webmaster.Ninja