// ASP-Style Tags Are Okay in PHP 3.0.4 and Above; Some HTML Editors Recognize Tags // File Upload Script for PHP / 3 for Windows // ReleaseD Under The Terms of The Public GNU License // Based Upon code written by Rasmus Lerdorf // Modified for Windows by Michael Grier // E-mail: bigmike@bigmweb.com // you need to write-enable a directory, named "upload", below the one you place this script in // On Windows NT, You Can do this with a dos program for this can be found at "http://www.bigmweb.com/home/cacls.html" f ($ action1) {// if files HAVE BEEN UPLOADED, PROCESS THEM?>
File Upload Results < / font>
s et_time_limit (60);. // make reasonably sure the script does not time out on large files $ path1 = dirname ($ PATH_TRANSLATED) "/ upload /"; // assign our path in a form PHP for Windows understands $ source = $ File1; $ source_name = $ file1_name; if (($ Source <> "None") && ($ source <> ")) {// see if the file exists; non-existing file Has name of" None "IF $ Error1 <>
1) {// no need to copy a file if Directory Not Write-enabled $ dest = $ PATH1. $ SOURCE_NAME; // Append File Name to Our Path IF (Copy ($ SOURCE, $ DEST)) {// COPY THE File from The Temp Directory to the Upload Directory, And Test for Success Echo "$ Source Has Been Uploaded
/ n"; $ ImagesIze = GetImagesize ($ DEST); Switch ($ imagesize [2]) {casse 0: echo "
"; unlink ($ DEST); exit; case 1: echo
"; echo" $ DEST HAS A WIDTH OF $ images z [0 ]
"; Echo" $ DEST HAS A Height of $ imagesize [1]
"; $ newname = $ PATH1; $ newname = Time (). ".gif"; if ($ DEST, $ NEWNAME)) {echo "
Gif Rename Successful from $ DEST to $ NEWNAME";} else {echo
Gif Rename Unsuccessful "} Unlink ($ DEST); Break; Case 2: Echo"
"; echo" $ DEST HAS A WIDTH OF $ images z [0]
Echo "$ DEST HAS A HEIGHT OF $ images [1]
; $ newname = $ path1; $ newname. = time ()." .jpg "; if (Copy ($ DEST, $ NEWNAME)) {echo "
JPG Rename Successful from $ DEST to $ NEWNAME";} else {echo "
JPG Rename Unsuccessful";} UNLINK ($ DEST); Break; Case 3: Echo
iMage IS A PNG < Br> "; echo" $ DEST HAS A Width of $ Imagesize [0]
"; Echo" $ DEST HAS A HEIGHT OF $ ImagesIze [1]
"; $ newname = $ Path1; $ newname. = Time (). "" {echo "
PNG Rename Successful from $ DEST to $ newname ";} else {echo"
PNG Rename ";} unlink ($ dest); break;}} else {echo" UPLOAD DIRECTORY NOT WRITE-Enabled / N "; // You NEED TO Write-enable the Upload Directory $ Error1 = 1;