We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

FieldFrame & nGen File Field - non image files?

Development and Programming

Deron Sizemore's avatar
Deron Sizemore
1,033 posts
16 years ago
Deron Sizemore's avatar Deron Sizemore

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!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
16 years ago
Deron Sizemore's avatar Deron Sizemore

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. 😊

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Deron Sizemore's avatar
Deron Sizemore
1,033 posts
16 years ago
Deron Sizemore's avatar Deron Sizemore

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!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
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

       
mahalie's avatar
mahalie
60 posts
15 years ago
mahalie's avatar mahalie

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;
    }
       
Jordan Moore's avatar
Jordan Moore
45 posts
15 years ago
Jordan Moore's avatar Jordan Moore

Excellent tip mahalie! That was bothering me for some time until I found your fix.

Many thanks, Jordan

       
misternifty's avatar
misternifty
6 posts
15 years ago
misternifty's avatar misternifty

I had the same issue and found that I had index.html in my image uploads folder. When I deleted it, the error went away. These errors come when propagating the use existing file dropdowns. It’s very picky as to what files can be contained in those upload directories.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.