kodaliece@gmail.com wrote:
> Hi All,
>
> I am using a simple php script to learn file upload functionality in
> php.
>
> Below is my html form code:
> <html>
> <title>
> File Upload FORM
> </title>
> <body>
> <form action="upload_file.php" method="POST" enctype="multipart/form-
> data">
> Select your file: <input type="file" name="inputFile"
> id="inputFile">
> <BR>
> <input type="submit" value="Upload">
> </form>
> </body>
> </html>
>
> and my upload_file.php file is:
> <?php
> // chekc the type of the content uploaded
> if (($_FILES["inputFile"]["type"] == "image/gif") ||
> ($_FILES["inputFile"]["type"] == "image/jpg") ||
> ($_FILES["inputFile"]["type"] == "image/pjpeg") &&
> ($_FILES["inputFile"]["size"] > 20000))
> {
> if ($_FILES["inputFile"]["error"] > 0)
> echo "Error: ".$_FILES["inputFile"]["error"]."<br/>";
> else
> {
> if (file_exists("upload/".$_FILES["inputFile"]["name"]))
> echo "Error: File \""."upload/".$_FILES["inputFile"]["name"]."\"
> already exists!";
> else
> {
> move_uploaded_file($_FILES["inputFile"]["tmp_name"], "upload/".
> $_FILES["inputFile"]["name"]);
> echo "Stored the file: ".$_FILES["inputFile"]["name"];
> }
> }
> }
> else
> {
> echo "Invalid File";
> }
> ?>
>
> But this is not uploading the file and is always printing "Invalid
> File". So I tried to echo the file name, type, size and error values.
> But its printing nothing. The same code worked with IIS. But, now I am
> using tomcat and its not working.
>
> Can any one please me on this.
>
> Thanks in advance,
> Mohan
>
What do you have in your $_FILES array? i.e.
echo "<pre>\n";
print_r($_FILES);
echo "</pre>\n";
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================