4

IMPORTANT: It turned out that this question couldn't really be answered based on the info I had provided, and it wasn't possible for me to provide enough info to make it answerable. Tom provided the best steps for debugging this type of issue in a normal situation so I'm giving it to him, but in my case the issue being that some changes to core that are not released yet, were causing problems in the way that Secure form processing worked. Turning of secure form processing until this issue is remedied was the solution that worked for me.

The Question:

I'm running the latest version of ExpressionEngine, and I'm a little stuck with a file field. Oh why oh why did I enable that? The issue I'm having is with the file modal that pops up either on adding a file in a file field or the clicking the little image icon by other fields. I can type whatever I want in the search field, or toggle the sorts, but the contents stay the same. Likewise the pagination links don't work:

enter image description here

I know that there are a number of files in that folder with names that begin in 121130. There seems to be no way to navigate around and find the file I want to add so I'm stuck. I'd love any of three types of advice listed in order of usefulness:

  1. How can I convert this file field back to a plain input field without losing the path information: {filedir_11}filename ?
  2. How can I debug this issue and figure out how to make it work?
  3. How can I manually modify the contents of this file field entry, even directly in the database to get the file I want selected even if the file modal doesn't work?
  4. Am I the only one having this issue?

update: I had already gone into the inspector and seen that requests were fired off to admin.php (renamed to mcp.php in my case), but I didn't exactly know what a proper query looked like. Tom's Answer contained a helpful screenshot of what a request and response looks like. I find that mine is making queries, but the request seems to maybe be getting redirected and losing the query in the process. Here are some screenshots to illustrate:

requests after query entered

Here you see that when I click into the search window it loads two images, then when I type a 1 it fires a request from jquery.js to mcp.php which then seems to get 302 redirected twice before getting a response useless to jquery:

jquery gets back cp html

Here is the response for that third request (the others resulted in a 302 so obviously returned nothing) As you can see it is returning html, not json.

So now the issue becomes figuring out where those redirects are coming from. Do I need to look to Apache? I'm not immediately seeing anything there that should be causing this, but it is possible I'm missing something.

Update 2: I thought I had this thing licked. I went into my admin.php file and found where I had set a non https link to the control panel in the Multi-Site Manager settings. I know I have a redirect set in apache to redirect all non ssl requests for the control panel through to ssl, so I thought that would get rid of at least one of those redirects… Result: no change.

  • I have had this issue in the past as a result of an improperly uploaded theme file. Can you check your console to see if you have any errors. – Justin Long Dec 3 '12 at 8:44
  • Thanks Justin, I should have mentioned. I did check that, and no errors except for some about not being able to find my smileys which I fixed and 1 about loading an avatar image over http from my https control panel. Nothing that indicates something missing. – UltraBob Dec 3 '12 at 8:46
  • Three things to check: 1) if you go to the main file manager and search/filter there, do you get the same bug? 2) if you inspect the request headers for your ajax request, what are they? They should be 'Accept:application/json, text/javascript, /; q=0.01' or similar. 3) (just a sanity check) what is the full url that the request is going to? it should be like this (session id removed): admin.php?D=cp&C=content_publish&M=filemanager_actions&action=directory_contents – Tom Davies Dec 4 '12 at 9:29
  • 1) Yes same bug 2) Accept:application/json, text/javascript, */*; q=0.01 3) /mcp.php?S=0&D=cp&C=content_files (boy I hate these comment fields) Also the url I get when I visit the File Manager in the control panel is: /mcp.php?S=0&D=cp&C=content_files perhaps I should already have mentioned this, but my session type is set to cookies only, because of a security issue the security team at my organisation had with the way EE2 was handling sessions. – UltraBob Dec 4 '12 at 14:10
  • hmm, just to rule it out as a cause I changes admin_session_type to s. It still doesn't work, I still see the redirects too, but the url looks more similar to yours now, and I seem to occasionally be able to get it to do some very limited filtering before it stops working altogether. Still, it doesn't work, even on a folder containing only three files. – UltraBob Dec 4 '12 at 14:18
3

Let's take a crack at (2) first of all, because it seems to me like getting this working using the File FT will require the least mucking about in total. When you use the search box in the file manager modal, an ajax request should fire off back to the CP to look for results:

ajax request

Is that request firing (see the "network" tab of your web inspector), and if so what does the response look like? It should return a bunch of JSON (even if there are no matching results).

ajax response

Update your question with the answers to those two questions and we'll go from there.

| improve this answer | |
  • OK Tom, it looks like this is the right path of inquiry. The response those queries are getting is not json, but rather html including this bit: <div class="js_notification" style="top: 0;"> <div class="notice_inner js_error"> <span>Javascript must be enabled in order for this theme to function properly. Please check your browser settings.</span> </div> </div> I'm not actually quite sure where to go from here on debugging this, but I'll dig in some more and update the question, any suggestions appreciated. – UltraBob Dec 4 '12 at 3:32
  • obviously I don't know how to get formatting to work in comments like I want. :P – UltraBob Dec 4 '12 at 3:35
  • I'm not sure my above comment is relevant, I'll expand in my question. – UltraBob Dec 4 '12 at 3:53
1

I admit to not using the field_type file, primarily because I like having more control over images. I typically either have clients use the file upload button and then entire the name of the file in a text field or use a different field type, like Assets (from Pixel & Tonic).

From testing, at least on my Mac running Mountain Lion and Safari 6.0.2, I'd say there is a a javascript issue. When you type in the initial filter, if it doesn't start limiting the field immediately, I'd look at file synchronization and or javascript as the issue. I've included some troubleshooting steps below, but first…

If you are not too opposed to losing the {filedir_11}filename, I'd recommend the following:

Assuming most images belong to various sections of your site, and that you store images in associated folders (example: About Section images are stored in /images/about/ ). Then you can just create the appropriate template code:

<img src="{domain}/images/{section}/{field_name}" alt="" />

For images in content, I've found the file upload under the textarea still works for inserting an image in.

Alternatively, I really do love Assets by Pixel & Tonic. I find it a really great file manager. Others may prefer Channel Images by DevDemon, I haven't used it. If your project can't afford that, but already has the Matrix field type, that also works very well at managing images.

If you really want to get the File field_type working properly, I suggest…

  1. Turn on Debugging Options- if your images aren't separated into multiple directories the issues could just be the amount of time it takes to filter. Even with Assets, I find a directory with over 200 images can take a while to filter. But Assets provides visual feedback that it's still working.
  2. Group Images Into Folders- this goes with the above, but the less items per directory the better. A directory of 50 images will always be more responsive that a directory of 300 images, so instead of just using /images use folders like /images/about/, /images/howto/, /images/reviews/, etc.
  3. Review Any Control Panel Modifiers- things like 'Responsive CP', Control Panel Themes (I use Nerdery to change pink to blue), etc. It's possible that something is just confusing the File Browser.
  4. Make Sure Image Directories Are Synchronized - This is new in EE2, but see: http://ellislab.com/expressionengine/user-guide/cp/content/files/sync_files.html In the File Upload Preferences, there is a new synchronize option. I believe this creates a database reference for all items in the directory, so javascripts are processed faster. Scanning a file directory can be a bit longer than a MySQL query. It's possible, that once all images are properly sync'd that your keywords filter may start filtering again.
| improve this answer | |
  • Thanks, I've just skimmed your answer so far and promise to read it through fully when I get to a bigger screen. I'm not married to the way I do it, I wish I still had my plain input field. I don't need an addon at all for this, it is very simple. You may be on to something with the big directory of big files idea, but I'm kind of stuck with that now and it was working before. I thought that was the whole point of syncing directories, which I have done. – UltraBob Dec 3 '12 at 13:11
  • Hi Just reviewed the whole answer. Good recommendations, but aside from trying a plugin I have tried everything listed there. It seems to be an issue in javascript like you say, but the error message is never displayed on the page, and if I look at the response in the developer tools in the browser the message isn't particularly helpful anyway. One thing to clarify: These are not images, they are video files. – UltraBob Dec 4 '12 at 3:45

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.