When attempting to upload an image I receive the following message:

File upload failed - please check your permissions for '/var/www/clients/civil-site/sites/default/files/images/' and also your php.ini settings.

I have installed the plugin in my sites/all/modules/ directory and configured it. I have also granted 777 permissions recursively to the sites/default/images directory. Safe_mode is disabled globally on my server and the cookie_domain variable is set in sites/default/settings.php.

Any ideas what could be wrong?

Comments

kayakjim’s picture

Assigned: kayakjim » Unassigned
pixture’s picture

flavor’s picture

+1 subscribing

All my perms are 777 on those directories.

pixture’s picture

Assigned: Unassigned » pixture

I need more information. I would appreciate if you can answer to the following questions.

1) Is the problem reproducible everytime? or does it happens occasionally? or only once?
2) Does this happen only when you upload the file to a certain directory? or any directory?
3) Does this happen with any kind of file? (big file, small file, image, non-image file ...)?
4) When this error happens, do you see _thumbs directory where thumbnail image is supposed to be placed?

In addition, could you try the development snapshot version to see if you end up with the same error ?

Thank you in advance.

gdvickery’s picture

From what I can tell, the problem seems to be the cookie authentication point in config_tinybrowser.php.

At around line 76 of config_tinybrowser.php you have an "if" statement that reads:

if (isset($_COOKIE[session_name()])) { 
   // lots of code here...
}
else {
  watchdog('tinybrowser', 'Error: Invalid direct access!');
  return FALSE;
}

If your remove the if statement, keeping the contents within the first block intact, everything works fine. The watchdog logs also show this as the issue.

I've noticed some people say it works and others say it doesn't. My guess is its something to do with the way the actual cookie is set in settings.php. Based on the Drupal documentation, the $cookie_domain variable should contain a valid domain including TLD or else it wont be set.

I'm working on a local development environment (aka: http://localhost).

I hope this helps.

pixture’s picture

@geekforbrains,

Thanks for the information. I have never tested it with localhost since I am running DNS on my local host and using TLD domain.

Anyway, the way the $_COOKIE is handled is changed by the development snapshot version. I believe that newer code handle the cookie better. It would be nice if you can try the newer version (dev snapshot release) to see if you end up with the same error or not.

Thank you,

gdvickery’s picture

@pixture

Tried the development release. If I don't set the $cookie_domain variable in settings.php, it doesn't work (did this just for testing purposes). However, if I set the variable to anything (ie: "localhost", "/", "test"), it works without issue.

Cheers

pixture’s picture

Yes,

$cookie_domain is a requirement for the TinyBrowser. Without $cookie_domain defined, TinyBrowser can not share the same cookie with Drupal. For the security purpose, using cookie is only the way to make sure that TinyBrowser is accessed by the same client who has successfully logged in as an authenticated user.

Anyway, the result you got with dev-snapshot release is exactly as I expected.

Thank you for testing it.

BTW, new beta release is coming soon which has added context menu for quick rotate/resize/rename/delete within the browsing pane.

mdodge’s picture

I am using the latest dev snapshot, have set the $cookie_domain variable, have the directories set to 775.

Using Windows browsers, I can upload one file at a time, and they work. If I try two or more, the results are a bit more random, sometimes working, sometimes not.

Using any Mac browser, however, I get this error without fail every single time.

I suspect that there is something about the way the browsers are sending the session cookie which is causing the problem. Possibly something related to the flash uploader (I seem to recall a lot of problems with flash uploaders for clients using wordpress, etc.).

Any help would be appreciated.