Use http://us.php.net/file_exists to check if swfupload.swf, swfupload.js, swfupload.queue.js are in the swfupload dir. If not throw an error to the screen with a link and instructions.

CommentFileSizeAuthor
#5 drupal_status_page.jpg194.84 KBgrandcat

Comments

mikeytown2’s picture

Probably should add a link to the permissions page as well, since they most likely didn't read the readme file.

admin/user/permissions#module-image_fupload
grandcat’s picture

Title: File Exists » swfupload files check

This is already integrated. Does it not work for you?

/**
 * Implementation of hook_requirements().
 */
function image_fupload_requirements($phase) {
  $requirements = array();
  
  if ($phase == 'runtime') {
    // Make sure that swfUpload Files which aren't bundled with this module, are located in swfupload directory
    $path = drupal_get_path('module', 'image_fupload') .'/swfupload/';
    if (!file_exists($path .'swfupload.js') || !file_exists($path .'swfupload.queue.js') || !file_exists($path .'swfupload.swf')) {
      // One or more needed files are missing; give an error
       $requirements['image_fupload'] = array(
         'title' => t('Image FUpload'),
         'value' => t('Missing or wrong files in subdirectory "swfupload"'),
         'description' => t('Some needed files which are not bundled with this module, are missing or out-of-date! This can be either "swfupload.swf", "swfupload.js" or "swfupload.queue.js" which should be located in "%path". These files can be downloaded from !page. <em>Note:</em> Version 2.2.0 or higher is needed.', array('%path' => $path, '!page' => l(t('SWFUploads project page'), 'http://code.google.com/p/swfupload/'))),
         'severity' => REQUIREMENT_ERROR,
       ); 
    }
  }
  
  return $requirements;
}
mikeytown2’s picture

Never saw the error, went back to the readme and followed the instructions. Then wrote this. Does this error get thrown in the node edit/create? In the file check you need all 3 files right? probably want to use && instead of || in the if statement.

grandcat’s picture

No, it works because file check is used invert in addition to the OR-statement.
You know that the error message will be thrown at status report?

grandcat’s picture

StatusFileSize
new194.84 KB

Have a look at the screenshot.. It works for me.

mikeytown2’s picture

Status: Active » Closed (fixed)

I should make a rule that I can't post in the morning... that if (and/or) thing was dumb. You might want to add a link to permissions; throwing the error on the node (add it to image_fupload_imagefield_form_alter).

grandcat’s picture

This is an idea, but the Admin should normally make it work (and he can always see occurring problems on status page), not the user.