Page 1 of 1

Weird upload problem

Posted: Mon Mar 01, 2010 5:50 am
by teddyfer
Hello everyone, I just want to ask around if anyone of you here have exprerienced this problem when you were creating a basic upload script with php. I encountered a weird problem, actually I have a working upload script what I did is i just copied the script and change the variables. The problem surfaced when I tested it, the working script can no longer retrieve/get the file info of the uploaded file. here's my code, its very basic but I don't understand why its no longer working.

My html code:

Code: Select all

 
<form action="sample.php" method="POST" enctype="multipart/data-form">
    <input name="before" type="file"/>
    <input type="submit" value="Upload Now" />
</form>
 
The upload script that I am using:

Code: Select all

 
$filename = $_FILES['before']['name'];
        $filetype = $_FILES['before']['type'];
        $filesize = $_FILES['before']['size'];
        $filetempdir = $_FILES['before']['tmp_name'];
        $up_error = $_FILES['before']['error'];
        $upload_directory = "../photo/diagnosis_photos/";
        $file_directory = "../clinic/photo/diagnosis_photos/";
        $diag_photo_filename = $file_directory.$filename;
        
        if($up_error > 0)
        {
            die("ERROR!");
        }
        else
        {
            if(move_uploaded_file($filetempdir,$upload_directory.$filename))
            {
                $sql = "UPDATE tbl_imagediagnosis
                        SET imgdiag_before_diagnosis = '$diag',
                        WHERE imgdiag_id = '$imgdiag_id'";
                dbQuery($sql);
            }
            else
            {
                echo "upload error";
            }
        }
 
I get no errors or any notice...it just doesn't simply work. I would appreciate your big help. Thanks in advance.