Make your own free website on Tripod.com

File Upload Results

"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
"; $imagesize = getimagesize($dest); switch($imagesize[2]) { case 0: echo "
Image is a unknown
"; unlink($dest); exit; case 1: echo "
Image is a GIF
"; echo "$dest has a width of $imagesize[0]
"; echo "$dest has a height of $imagesize[1]
"; $newname = $path1; $newname .=time() . ".gif"; if(copy($dest,$newname)) { echo "
GIF Rename Successful from $dest to $newname"; } else { echo "
GIF Rename Unsuccessful"; } unlink ($dest); break; case 2: echo "
Image is a JPG
"; echo "$dest has a width of $imagesize[0]
"; echo "$dest has a height of $imagesize[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
"; echo "$dest has a width of $imagesize[0]
"; echo "$dest has a height of $imagesize[1]
"; $newname = $path1; $newname .=time() . ".png"; if(copy($dest,$newname)) { echo "
PNG Rename Successful from $dest to $newname"; } else { echo "
PNG Rename Unsuccessful"; } unlink ($dest); break; } } else { echo "Upload directory not write-enabled "; // you need to write-enable the upload directory $error1 = 1; // set flag } } unlink($source); // delete the file from the temp directory } ?>
Back

File Upload

File Upload

If your browser is upload-enabled, you will see "Browse" (Netscape, Internet Explorer) or ". . ." (Opera) buttons below. Use them to select file(s) to upload, then click the "Upload" button. After the files have been uploaded, you will see a results screen.

File 1: