I’ve created two new custom fields on a site. The first is an nGen File Field. I’ve set the file upload preferences on this directory to “all file types.” The second custom field is a FieldFrame Matrix field and I’m using one nGen File Field and one basic text field in the matrix. The nGen File Field in the matrix is also there to upload “all file types.”
I go into publish a new entry and everything seems fine. Once I click submit on the new entry, all of the files upload to the sever as they should but if I were to go back in and edit that same entry, there’s probably 30 or more error messages at the top of the publish screen and they all say the same thing:
Warning: exif_imagetype() [function.exif-imagetype]: Read error! in /www/eh10843/public_html/system/extensions/fieldtypes/ngen_file_field/ft.ngen_file_field.php on line 797
Would love to know what I’m doing wrong. Thanks!
Hi Deron,
I must first say that I’ve never seen that error so not entirely sure what it is but I’m just wondering what other file types they are that you are uploading? Perhaps as the nGen File Field makes a small icon view of an image (when uploading images) it is trying to create an icon for something that it can’t? Just a complete guess though as I say I’ve never tried uploading much else using that extension yet. Have you tried contacting Fred about it yet?
Best wishes,
Mark
That very well could be the case, Mark. I uploaded .txt files last night just as a test and then got the error messages. I believe the client will need to be able to upload .pdf documents and music files like mp3’s or other (not sure what type exactly). I’ll try a pdf document just to see what happens.
No I’ve not tried contacting Fred. I may drop him a PM or something. I always hate doing that though. Feel like I’m bugging people. 😊
Actually it could well be something else although I’m still not entirely certain. I just tried uploading an .rtf file and it showed fine (albeit without an icon image but then I guess it would do).
Just out of interest how large was the file that you were uploading? Was it quite small? If so then out of interest just try uploading a much larger file >10Kb and see if that does anything different.
Best wishes,
Mark
Hey Mark. Fred took a look at this for me and it was because the .txt files I uploaded were zero bytes. I just created some quick .txt files to use as tests not knowing if they were blank it would cause the issue. Once they were not blank it worked just fine. Looks like you were right with your assumption above. 😊
Thanks!
Hey Mark. Fred took a look at this for me and it was because the .txt files I uploaded were zero bytes. I just created some quick .txt files to use as tests not knowing if they were blank it would cause the issue. Once they were not blank it worked just fine. Looks like you were right with your assumption above. 😊 Thanks!
Aha thought it might have been that somehow. From memory a file needs to be at least 3kb for that function to be able to figure out what the file type is. Anything lower than that can trigger that error.
Glad you’re all sorted now.
Best wishes,
Mark
I experienced the same error. In my case it was due to an upload error storing nothing the field. In other words, I need to clean out the blank entries in ngens table in mySQL but in the meantime to prevent this error in the case of tiny or non-existent files I just wrapped the exif_imagetype() bit with a check for filesize, so at line 797 I put the IF loop around the switch statement. Thought it might be useful for someone else.
// MS 20091124: added if check around switch due to READ ERRORs
// exif_imagetype throws "Read error!" if file is too small
// see http://php.net/manual/en/function.exif-imagetype.php
if (filesize($file) > 3){
switch( exif_imagetype($file) ) {
case IMAGETYPE_GIF:
case IMAGETYPE_BMP:
case IMAGETYPE_JPEG:
case IMAGETYPE_PNG:
$is_image = true;
break;
}
}
return $is_image;
}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.