View Single Post
  #2 (permalink)  
Old May 10th, 2005, 06:20 AM
anshul anshul is offline
Friend of Wrox
 
Join Date: Mar 2004
Location: Bhopal, MP, India.
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

Here's ( may be ) for your help:
    
Quote:
quote:if ($_POST['submit']=="UPLOAD") {
Quote:
        for($i=0; $i<5; $i++) {
            if($_FILES['userfile']['size'][$i]>"1048576")
                echo "<pre>Can't upload a file; filesize > 1 mb or 1024 kb or 1048576 bytes.</pre>";
            if ( ($_FILES['userfile']['size'][$i]<="1048576") && ($_FILES['userfile']['tmp_name'][$i]!="") ) {
                if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $_SERVER['DOCUMENT_ROOT']."/images/".$_FILES['userfile']['name'][$i])) {
                    echo "<pre>Upload successful.\n";
                    echo "File: ".$_FILES['userfile']['name'][$i]." (".$_FILES['userfile']['size'][$i].") bytes\n";
                    echo "Renamed: ".$_FILES['userfile']['name'][$i]."</pre>\n";
                }
                else
                    echo "<pre>Can't upload file due an error.</pre>";
            }
            if( ($_FILES['userfile']['tmp_name'][$i]=="") && ($_FILES['userfile']['size'][$i]=="0") )
                echo "<pre>No file specified.</pre>";
        }
    }


Reply With Quote