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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.