Well, first thing I notice is that in your form you name your file input as
"file", yet nowhere in your code do I see you getting any values from _FILES
or $file (depending on your version of PHP). So...how do you expect it to do
anything with your file if you don't tell it to?? Maybe you left out the
part of your code that does that...

Also, you set allow_file_type to 1, then you say if($allow_file_type ==
1)...well, duh, of course it's equal to one, you just set it to one...what
are you trying to accomplish with that?

Also, where is $type coming from?

---John Holmes...

----- Original Message -----
From: "Thomas Edison Jr." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 10, 2002 12:18 PM
Subject: [PHP] File Type not working in Uploaded File


> Hi,
>
> This is my upload form :
>
> <form action="upload.php" method="POST"
> enctype="multipart/form-data">
>   <p align="center"><font size="2"
> face="Verdana"><strong>Please upload your
>   file below:</p>
>   <input type="file" name="file" size="30">
>   <p><input type="button" name="submit" type="submit">
> Upload
> </form>
>
>
> And this is part of my PHP coding, that handles the
> Upload. Basically the problem is, that my code is not
> recognising the File Type! I have specified
> "image/jpeg" as the file type, but even then it does
> not upload ANY file at all. In fact it gives the
> specific error which i have associated when the file
> type is wrong.
>
> *********
>
> $allow_type = "image/jpeg";
> $allow_file_type = "1";
>
> $not_correct_file = "<b><font face=\"$font\"
> size=\"$font_size\" color=\"$font_color\">Sorry, but
> the file you tried to upload is not valid file to
> upload!";
>
> if ($allow_file_type == "1") {
> if ($allow_type != $type) {
> die("$not_correct_file");
> }
> }
>
> *********
>
> Why is it that it is NOT recognising ANY file type. I
> tried removing the Cheking of FILE type, and the
> program was working fine, where it was Uploading ANY
> file. However, as soon as i put in this particular
> code to check for File Type, it does NOT upload any
> file.
>
> Help!
>
> T. Edison Jr.
>
>
>
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Mother's Day is May 12th!
> http://shopping.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to