PDA

View Full Version : [fixed] The uploaded file is not a valid GIF or JPG file. Please ensure that



mojotim
Thu 2nd Aug '01, 9:30am
When I try to upload an image attachment I get this:

The uploaded file is not a valid GIF or JPG file. Please ensure that it is an try again

It all worked before. Upgraded from 2.01 to 2.02 to 2.03 this morning. Did not test if it worked in 2.02.

*******More info for you

URL of your forums: http://www.visionmtb.com/index.php?action=forums

PHP version: 4.0.3pl1

MySQL version: 3.23.32

Apache/webserver version: 1.3.19

Server operating system: Linux

Any error message you are getting:

The uploaded file is not a valid GIF or JPG file. Please ensure that it is an try again

Mike Sullivan
Thu 2nd Aug '01, 2:09pm
In your CP's options, change the value of the last option in the "upload options" section (re: getimagesize).

mojotim
Thu 2nd Aug '01, 4:07pm
I tried both and it still does not allow images to be posted. Same error wheter yes or no. Tried both in Netscape and IE.

It used to work fine, can I revert this part back to the way it was in 2.0.1? If so, how?

mojotim
Thu 2nd Aug '01, 11:12pm
I took this out of functions.php:

} else {
if (!$allowimgsizefailure) {
eval("standarderror(\"".gettemplate("error_avatarnotimage")."\");");
}


And now it works. Will this affect anything else?

AaronB
Fri 3rd Aug '01, 12:44am
same issue for me... avatar upload works just fine, but can't attach images to posts. I did try to change the option as suggested

Specs:

php - 4.0.3pl1
mysql - 3.23.32
os - red hat 6.2
webserver - apache 1.3.## (host wasn't sure off the top of his head)

AaronB
Fri 3rd Aug '01, 12:49am
And ditto for me on mojotim's fix... took out those lines and can now upload fine

AaronB
Sun 5th Aug '01, 11:10am
Any news on this? What's the result of removing these lines of code?

I haven't implemented this on my live site yet pending some verification of it being ok, and users are anxious to get their image attaching back.

Mike Sullivan
Sun 5th Aug '01, 7:00pm
Removing those lines is the same thing as the real bug fix. :) (adding $allowimgsizefailure to the list of global variables to that function)

Una Persson
Wed 15th Aug '01, 4:12pm
Please excuse my newness and ignorance, but is what you are saying that the correct way to fix this is to change the global variables of that function to look something like:



global $DB_site,$attachment,$attachment_size,$attachment_ name;

global $attachextensions,$maxattachsize,$bbuserinfo,$maxa ttachwidth, $maxattachheight;

global $safeupload,$tmppath, $allowduplicates, $allowimgsizefailure;


?

JamesUS
Wed 15th Aug '01, 4:30pm
Yep :)

Una Persson
Wed 15th Aug '01, 5:17pm
Thank you. :)

mjames
Fri 17th Aug '01, 4:49pm
I am having a problem. My users are reporting the same problem with their avatars and I tried removing:

} else {
if (!$allowimgsizefailure) {
eval("standarderror(\"".gettemplate("error_avatarnotimage")."\");");
}
... but when I did (I double-checked I removed the right part), we can't start new threads. It says "thanks for posting", but returns you to the board without your thread showing up. Help!

Mike Sullivan
Fri 17th Aug '01, 9:17pm
Those are 100% unrelated... Sounds like you have moderation enabled.

mjames
Sat 18th Aug '01, 1:25am
Those two problems just happened to be at the same time this afternoon. Apparently, I am no longer having that problem with threads not showing up. It just suddenly went away after suddenly appearing.

My real problem that does relate to this is my user's can't upload avatars, still. they're getting the "not valid" message. See, I tried and removed that line of code above, and it didn't work.

Mike Sullivan
Sat 18th Aug '01, 1:51am
Put the following in error_avatarnotimage:

getimagesize type: $imginfo[2] <br>
browser reported type: $avatarfile_type <br>

What does it output?

jcroft
Fri 24th Aug '01, 9:20pm
I have the same problem...for me, putting that in there reports nothing at all....pasting it in:

vBulletin Message
The uploaded file is not a valid GIF or JPG file. Please ensure that it is an try again. getimagesize type:
browser reported type:

jcroft
Fri 24th Aug '01, 10:04pm
When I take out the code sugegsted in the first few posts, I don't get the error message anymore. However, the image still is not uploaded properly, and it displays as a broken image icon, rather than the correct image.

Anyone know how to fix this one?

jcroft
Sat 25th Aug '01, 10:30am
Anyone? I'm at a total loss! I'd be happy to give a support team member access to my server if necessary to help figure it out...

jojo
Wed 29th Aug '01, 5:29am
any help on this..??!?!?

tamarian
Fri 31st Aug '01, 12:55am
Folks,

I have tried adding $allowingimgsizefailure, to the global variables, but it didn't work.

In my case it was a specific gif that was a duplicate, but duplicates were allowed.

Do you know what fixed the problem in my case? Don't laugh!

In admin cp, append the first type to the end of the allowed lists

i.e. gif zip png jpg jpeg gif

Looking at the code, I think it assumes there's a space before and after each extension type. So adding a space to the beginning should fix it. I did both just in case someone thinks the first blank is a typo.

Kodo
Wed 12th Sep '01, 10:36pm
Originally posted by Una Persson
Please excuse my newness and ignorance, but is what you are saying that the correct way to fix this is to change the global variables of that function to look something like:



global $DB_site,$attachment,$attachment_size,$attachment_ name;

global $attachextensions,$maxattachsize,$bbuserinfo,$maxa ttachwidth, $maxattachheight;

global $safeupload,$tmppath, $allowduplicates, $allowimgsizefailure;


?

I've tried this.. however, the images show as a red x but the post does go through.. any word on a fix for this yet?

kicks
Wed 26th Sep '01, 11:08am
Originally posted by jcroft
When I take out the code sugegsted in the first few posts, I don't get the error message anymore. However, the image still is not uploaded properly, and it displays as a broken image icon, rather than the correct image.

Anyone know how to fix this one?

I'm having the same issue. I removed the code from functions.php and it shows that it works, but the image shows up as broken :(

I'm also trying to figure out if it's because the server is running plesk.

kicks
Wed 26th Sep '01, 3:57pm
fixed, n/m :)

BBInsider
Sat 29th Sep '01, 12:17am
Ive had this problem for a while now.
So which one is the fix and where is it found? Thanks!

bg63
Sat 29th Sep '01, 3:17am
Dumb question:

In order to take out the offending code as mentioned, where do I access 'functions.php' from?

Thanks.

Redmak
Mon 1st Oct '01, 6:18am
Originally posted by tamarian
Do you know what fixed the problem in my case? Don't laugh!

In admin cp, append the first type to the end of the allowed lists

i.e. gif zip png jpg jpeg gif


I'm not laughing , I solved it the same way you did