Incorrectly reporting uploaded file is not a valid image.
Carlitus - March 29, 2007 - 11:16
| Project: | Image |
| Version: | 6.x-1.0-alpha3 |
| Component: | image.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
With the last version when i submit a new image drupal returns:
Uploaded file is not a valid image. Only JPG, PNG and GIF files are allowed
I've tried with jpeg and gif images. The images are really in this formats.
I've located the line, it's the 163 in image.module and i've put a var_dump
$image_info = image_get_info($file->filepath);
echo "<p>Image_info</p><pre>";
var_dump($image_info);
echo "</pre>";
if (!$image_info || !isset($image_info['extension'])) {
form_set_error($field_name, t('Uploaded file is not a valid image. Only JPG, PNG and GIF files are allowed.'));
return;
}When i submit a new image the var_dump it's executed twice:
Image_info
array(5) {
["width"]=>
int(16)
["height"]=>
int(16)
["extension"]=>
string(3) "gif"
["file_size"]=>
int(361)
["mime_type"]=>
string(9) "image/gif"
}Image_info
bool(false)

#1
Can you upgrade to the latest 5.x-1.x-dev version and verify that the error exists there too?
#2
The latest 5.x-1.x-dev version fixed this problem, for me.
However, I was urged to run update.php and when I did:
The module still appears to be working, but I haven't really tested it yet.
#3
BTG308, you should be alright. that query was designed to clean out old unreferenced attach records. could you open up a separate issue for that and provide some details about your SQL server?
#4
With the lastest 5 dev it works well. Thanks :)
#5
#6
Getting the error with 5.x-1.0
"The uploaded file was not an image."
Without upgrading to 5.x-1.x-dev is there anyway to fix this problem? I ask because running update.php didn't fix the problem in my case and also because update.php does not seem to update to 5.x-1.x-dev, i presume because its not a stable release.
Thanks
#7
I am getting this error with Drupal 5.1, bundled GD, PHP5, on an IIS 6.0 server. I have updated to the latest dev release (as of about 4 days ago), and it did not fix the problem. Is this an IIS compatibility issue possibly? What extra information can I provide to help figure this out?
#8
Just a quick troubleshooting follow up. I can use the image_import module to create image nodes just fine. I also updated to the April 17 (currently the latest version) dev version. I still can't create an image node in the normal way, though.
#9
make sure you're not trying to upload files larger than PHP's file size limit.
#10
If this error message is triggered when people try to upload a file which exceeds the PHP file_size limit, than that is a bug and needs fixing imo..
Re-opening as such..
Drewish/Walkah, feel free to enlighten me when you're going to close this issue without trying to fix it..
#11
Stefan Nagtegaal, i guess i don't see why i need to "enlighten me when you're going to close this issue without trying to fix it"... the original issue was resolved. Carlitus, who opened the issue reported it was working. it was fixed. Charlie Sibbach, re-opens the issue and based on his comments i give him a suggestion and re-close the issue. if you want to open a new issue to warn users of the maximum file upload size feel free to do so. better yet attach a patch (instead of just flagging the issue as having a patch).
#12
Sorry to stir up any trouble, but the problem is not fixed. I went and checked my php.ini, and the max file upload size is set at 2M- much larger than any of the files I've tried. I thought that might be a problem before I originally posted, and I just double checked now. I also checked the max upload size as set in the image module (2048 kb).
I tried uploading a file larger than the 2M limit, a large PNG. I recieved the message "The selected file C:\yaoikitten\files could not be copied.
Your Image", which is a very different error message. I know that that folder is writeable by all the processes, as the image import module works no problem. Something else is at work here. Unfortunately, I'm just learning Drupal still and I'm not ready to wade into debugging modules myself yet, but I can provide any info you need. For reference, image nodes (created via import) seem to work perfectly; the only thing broken is the normal upload mechanism.
#13
Uploaded file is not a valid image. Only JPG, PNG and GIF files are allowed.
#14
Charlie Sibbach, you need to ensure that you GD has PNG support enabled.
teyoo, that's not a helpful error message.
#15
#16
I'm also having this issue. I know I have write access, the images I'm testing with should work fine (30-60K, jpg).
I'm running IIS, tested with 5 and 6. The latest dev version of this Image module, and the latest version of Drupal.
"Uploaded file is not a valid image. Only JPG, PNG and GIF files are allowed."
Good luck!
#17
My problem was solved when I upgraded php from 5.2.4 to 5.2.5 It was an issue with the windows\temp directory not allowing php to access temp files.
#18
#19
Is this related to php version or can be fix by giving proper permissions to the temp directory? What are then the proper permissions?
#20
hi,
Here are my setting :
OS = Window XP
IIS = 5.1
Drupal = 5.1
PHP = 5.1.1
I also have this issue , what i do is :
1) change c:\windows\temp , i gave permission everyone = full control ..
it solved the problem .. but uhmmm ..security iissue ..???
#21
heh, guys i didnt solve this problen yet..... i changed permission in C:\windows\temp but it didn't help me...
i still have this problem and i don't know what i need to do