VB icon

File uploader/indexer

Submitted on: 1/1/2015 9:54:00 AM
By: InteractiveWebGuys (from psc cd)  
Level: Intermediate
User Rating: By 31 Users
Compatibility: PHP 3.0, PHP 4.0
Views: 2656
     This code indexs files, uploads, and deletes. PLease vote for me!

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
// for :File uploader/indexer
copyright 2001-2002 Interactive web Guys
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
// Name: File uploader/indexer
// Description:This code indexs files, uploads, and deletes. PLease vote for me!
// By: InteractiveWebGuys (from psc cd)
// Returns:It out puts a table to the browser that shows each file.
// Side Effects:none as of now

//this turns off error reporting we dothis so that we don't get a warning for the $action variable
//the directory that the script index's if you want the current directory put a "." if you want another folder
//put "foldername"
if ($action=='delete')
$del = unlink("./$destination/$fle");
echo '<FONT SIZE="+2" COLOR="FF9A00"><CENTER>File manager</CENTER></FONT><BR><BR><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=o><TR><TD ALIGN=center WIDTH=200 bgcolor=FFECCE><CENTER>Filename:</CENTER></TD><TD ALIGN=center WIDTH=200 bgcolor=FFECCE><CENTER>Functions:</CENTER></TD><TD ALIGN=center WIDTH=200 bgcolor=FFECCE><CENTER>Filesize(in bytes):</CENTER></TD><TD ALIGN=center WIDTH=150 bgcolor=FFECCE><CENTER>Filetype:</CENTER></TD><TD ALIGN=center WIDTH=150 bgcolor=FFECCE><CENTER>Created on:</CENTER></TD></TABLE>';
 $directory = opendir($destination);
 while( $file = readdir( $directory ) )
 $file_ar[] = $file;
 foreach( $file_ar as $file )
 if( $file == ".." || $file == "." )
$type= strrchr($file,'.');
$time=date("D M j Y",filectime($name2));
if($time=='Wed Dec 31 1969'){$time='Unknown';}
$file2 = dirname($name2);
 if($color == "FF9A00") {
 $color = "FFECCE";
 } else {
 $color = "FF9A00";
echo"<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=o><TR><TD ALIGN=center WIDTH=200 bgcolor='$color'><a href='$uname/$file' target=_blank>$name</a></font></TD><TD ALIGN=center WIDTH=200 bgcolor='$color'><A HREF='$PHP_SELF?action=delete&fle=$file&der=$uname'>Delete</A><TD ALIGN=center WIDTH=200 bgcolor='$color'>$sizeoff</TD> <TD ALIGN=center WIDTH=150 bgcolor='$color'>$type</TD><TD ALIGN=center WIDTH=150 bgcolor='$color'>$time</TD></TABLE>";
echo "<CENTER><FONT SIZE='+2' COLOR=\"FF9A00\"><BR><BR>Uploader</FONT></CENTER><BR><BR><FORM ACTION='$PHP_SELF' METHOD=post enctype=\"multipart/form-data\">File:<BR><INPUT TYPE='file' size='20' name='filename'><BR><CENTER> <input type=\"hidden\" name=\"action\" value=\"uploadProg\"><INPUT TYPE='hidden' name='action' value='upload'><INPUT TYPE='submit' value='Upload File'></CENTER></FORM>";
 echo "<h2>File Uploaded.</h2>";
 echo "<HEAD><META HTTP-EQUIV='Refresh' CONTENT=1></HEAD>";
 if ($filename=="none") {echo("<h1>No File Selected....</h1>"); break;}

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.