Jump to content

need basic help


dezkit

Recommended Posts

Hi i am trying to find a download link to a upload progress bar for php

But i am very confused!

here is my php code, i don't know what to do with it to make a upload bar! help me! :P

 

<?php
function findexts($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
global $string;
    $pattern = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
if(empty($length)){
    $length = "10";
    }
for($i=0; $i<$length; $i++){
    $string .= $pattern{rand(0,61)};
    }
    
$ext = findexts($_FILES['ufile']['name']); 
    
$path= "uploads/$string.$ext";
$ufilename = "$string.$ext"

if($ufile != none){
	if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)){
		echo "File Upload has been successful.<BR/><BR/>";
		echo "<table border=0>";
		echo "<tr><td>"; echo "File Name: "; echo "<td>"; echo "$ufilename";
		echo "<tr><td>"; echo "File Size: "; echo "<td>"; echo round(($HTTP_POST_FILES['ufile']['size']  / 1024),2); echo "MB (" . round($HTTP_POST_FILES['ufile']['size'],2) . " KB)";
		echo "<tr><td>"; echo "File Type: "; echo "<td>"; echo $HTTP_POST_FILES['ufile']['type'];
		echo "</table>";
		echo "<BR/>Click <a href=\"$path\">here</a> to view the uploaded file.";
	} else {
		echo "Error";
	}
}

?>

Link to comment
https://forums.phpfreaks.com/topic/126099-need-basic-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.