1

After upgrading from 1.6 to 2.9, I’m getting a set of the errors below when displaying a page containing images, one set for each image. I’m running PHP 5.4.x and it says “Fast CGI” after the 5.4.x.

A PHP Error was encountered
Severity: Notice
Message: Undefined index: upload_date
Filename: file/ft.file.php
Line Number: 303

A PHP Error was encountered
Severity: Notice
Message: Undefined index: modified_date
Filename: file/ft.file.php
Line Number: 304 

I also had Mark Huot’s File extension running in 1.6. I “resubmitted” or updated the field type for one custom field as “File” and I also ran the fix in this thread on this one custom file field, but only the part regarding the line breaks:

https://ellislab.com/forums/viewthread/218268/

and to see those in my template, I have to use the tag pair, or else nothing is output:

{myFileFieldName}{url}{/myFileFieldName}

I didn’t run the part about including the file directory, because EE is not parsing my {filedir_x} tag.

In all other cases of file fields, where I didn’t run the fix or update/resubmit the custom field type as File, I can get output by just using the stand-alone tag, but I still get the errors:

{myFileFieldName}

UPDATE:

I did some more digging. So this error/warning is taking place at lines 303 and 304 of expressionengine/fieldtypes/file/ft.file.php in a function called:

replace_tag($file_info, $params = array(), $tagdata = FALSE) 

and here’s where it chokes in that function:

$date_vars = array(
   'upload_date' => $file_info['upload_date'],
   'modified_date' => $file_info['modified_date']
);

I know next to nothing about PHP, but I reckon $file_info has a problem, so I did an echo on $file_info and it returns what looks like just a string: “Array”.

Not sure where to go from here to fix that. The upload_date and modified_date columns in exp_files table are filled with data, so I can't imagine what's up.

0

Sounds like you need to "re-sync" your files to force EE to generate the date data that it's looking for.

In the control panel, navigate to Content ‣ Files ‣ File Upload Preferences ‣ Synchronize Files.

Complete details are in the EE docs here:
https://ellislab.com/expressionengine/user-guide/cp/content/files/sync_files.html

The Synchronize Files page allows you to synchronize the file records in the database with the files stored in a given upload directory. When submitted, all allowed file types in the directory will be checked against the file records in the database. If there is no record in the database, one will be added. For images, any additional sizes will be generated and watermarked according to the file upload preferences for that directory. Lastly, any records in the database that do not have a corresponding file in the main directory will be deleted from the database along with any existing resized images. Existing images may also be set to regenerate resized images from this page.

1
  • Thanks for the ideas. It turned out to be something else, which I'll post in a moment. But your suggestions helped me figure it out.
    – Gregir
    Aug 19 '14 at 18:43
0

I had to do two things to resolve the issue:

  1. Apply both steps (adding the {filedir_x} and searching replacing new lines/line breaks) of the fix from this EllisLab forum thread across the board, to all File fields not just to one File field: https://ellislab.com/forums/viewthread/218268/

  2. I went into the Admin for channel fields and re-submitted each custom field that was a File field type.

Something about that exercise appears to have fixed the issue. Hope this helps someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.