FileChucker

Frequently Asked Questions

See also: Shared FAQ


How do I configure/customize FileChucker?
How do I change FileChucker's styling?
How do I embed FileChucker in another page, or within my site's existing layout?

I get an Internal Server Error!
I get an error when I try to call FileChucker from PHP using virtual().
I get an error in the middle of my upload, or it never finishes.
FileChucker's upload progress bar doesn't work.
FileChucker's upload progress bar doesn't work in Safari.
I use Network Solutions and I'm having trouble.
FileChucker won't thumbnail a certain image file; or, FileChucker's file-list page gets cut off partway through the list.

What's the biggest file that FileChucker can upload?
How fast can FileChucker upload files?

How do I enable the image features (thumbnails, rotation...)?
How do I add my own fields / text boxes to the upload form?
How do I enable email notifications, or fix email-sending errors?
How do I add an email field and send a notification email to the entered address?
How do I make my form fields appear in the notification email?
How do I use one FileChucker for multiple forms/pages on my site?
How do I get direct-download links instead of CGI-based download links?
How do I set or reset my password?
How can I hide or password-protect certain features?
How do I integrate FileChucker with UserBase?
How do I give each of my users their own private uploads folder?
How do I specify custom folder permissions?
Can I make FileChucker work with my existing login system?
How do I pass external data to FileChucker?
FileChucker (sometimes) says I'm not logged in, when I really am!
How do I ...

  

How do I configure/customize FileChucker?

Just edit your filechucker_prefs.cgi file in a text editor; it contains many adjustable settings.  This file is in your server's cgi-bin directory by default.  For example, you may want to adjust $PREF{title} and $PREF{intro} in PREFs Section 07.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I change FileChucker's styling?

To customize the styling (look and feel), just add your own CSS to the $PREF{custom_css_section} setting in PREFs Section 07 (older/trial versions) or $PREF{css} in PREFs Section 16 (newer versions).  To include an external CSS file, use a CSS @import statement:

$PREF{css} = qq`

\@import url("/mystylesheet.css");

[rest of FileChucker's CSS here]

`;

Notice that the @-symbol on the @import statement must be escaped with a backslash, otherwise Perl will treat it as a variable, which will result in an error.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I embed FileChucker in another page, or within my site's existing layout?

Embedding Method A: call filechucker.cgi from your PHP or SSI/shtml page:

  1. Within the <head> section of the PHP or SSI/shtml page where you want to embed FileChucker, add the following lines:

    <script type="text/javascript" src="/cgi-bin/filechucker.cgi?js"></script>

    <link rel="stylesheet" type="text/css" media="all" href="/cgi-bin/filechucker.cgi?css" />
  2. If your page is a PHP page, then add the following line to it wherever you want FileChucker's output to appear:

    <?PHP virtual("/cgi-bin/filechucker.cgi?" . $_SERVER['QUERY_STRING']); ?>


    Or, if your page is a plain HTML page with an extension of .htm or .html, rename its extension to .shtml and then add the following line to it wherever you want FileChucker's output to appear:

    <!--#include virtual="/cgi-bin/filechucker.cgi?$QUERY_STRING" -->
  3. In your filechucker_prefs.cgi file, set $PREF{print_full_html_tags} = 'no'.  Then set $PREF{here} = '/mypage.php' or '/mypage.shtml' where 'mypage' is the name of the page where you've embedded it.

    Now visit www.yoursite.com/mypage.php (or shtml) and you'll see FileChucker in the page.

    See step #5 of the installation instructions for more details on calling FileChucker from another page.

Embedding Method B: call filechucker.cgi directly, and let it display your HTML template file:

If your server doesn't support the PHP/SSI/shtml that's necessary for Embedding Method A (above), then you can use an HTML template file instead.  Your page will look exactly the same as with Method A; the difference is that Method B requires you to use the full URL to the CGI script itself, since your server doesn't support any other way.

First you create an HTML file in whatever way you normally create web pages.  Name this file encodable_app_template.html.  In the <head> section of this file, put the strings %%css%% and %%js%% each on their own line.  Then in the <body> section of the file, wherever you want FileChucker's output to go, put the string %%encodable_app_output%%.  Now upload this HTML file onto your website in its top level (i.e. not in a subfolder).

Now open your filechucker_prefs.cgi file and find the $PREF{print_full_html_tags} setting and set it to "no".  Near there, you'll also find the $PREF{encodable_app_template_file} setting; set that to "%PREF{DOCROOT}/encodable_app_template.html"; 

Now visit www.yoursite.com/cgi-bin/filechucker.cgi and it'll use your template file.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

I get an Internal Server Error!

If this happens after you edit your filechucker.cgi file, then the simple solution is: don't change filechucker.cgi at all.  Instead, only edit filechucker_prefs.cgi, as explained above.

But if you haven't edited your filechucker.cgi file and you still get an Internal Server Error, or if you absolutely need to edit filechucker.cgi, then see the Internal Server Error page for solutions to this problem, which is most likely caused by an installation issue and not a problem with FileChucker itself.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

I get an error when I try to call FileChucker from PHP using virtual().

If you get an error saying "call to undefined function virtual()" then that means your server doesn't support PHP's virtual() function.  This is only a minor issue, and it is not a problem with FileChucker itself.  It just means you need to use a different method for calling FileChucker from a shortcut URL.  (See step #5 of the full instructions for more details and alternatives to the virtual() function, but read the rest of this FAQ item first.)

Or, if you get a different virtual() error like "request execution failed", that probably means your filechucker.cgi isn't installed quite right.

Either way, the first thing to do is get FileChucker itself installed and working: visit www.yoursite.com/cgi-bin/filechucker.cgi and make sure that works.  Only after that works properly should you try to get the shortcut URLs working (www.yoursite.com/upload/ or www.yoursite.com/upload/index.php or www.yoursite.com/upload/index.shtml).  If your filechucker.cgi gives you an Internal Server Error, it's most likely a chmod/permissions problem, but see this page for full details on how to fix it.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

I get an error in the middle of my upload, or it never finishes.

If, during an upload, you get an error like "server cannot be found", "page cannot be displayed", "connection was reset", or "connection timed out", this is not a problem within FileChucker; rather, it's either a problem with your network connection, a problem with the server's network connection, or a problem within the server itself.

First disable the $PREF{use_iframe_for_upload} setting while debugging the problem, which may allow you to get a more detailed error message.  And also disable the $PREF{enable_debug} setting, to make sure that the extra debugging code is not causing problems on your server.

On IIS/Windows servers this problem may be caused by the server's setting for CGI execution timeout.  Other servers usually have no such timeout.  In no case is this caused by PHP settings (php.ini, etc), because FileChucker is not written in PHP and therefore is not affected nor limited by PHP settings.

If your server is running an extremely outdated version of Perl, that can sometimes cause these kinds of issues.  Try installing this test CGI script which will show you your server's Perl version and the version of its Perl CGI.pm module.  If the CGI version is 1.x or 2.x, then it's ancient and there's a good chance that this is the problem.  See perlhist for Perl versions & release dates, and CPAN for CGI.pm versions & release dates.  If your server's versions are 4 or 5 years old or older, then it's time to upgrade or find a better hosting company.

If you're getting errors during your uploads, in some situations it may help to set the $PREF{disable_upload_hook} setting to 'yes', and/or to set $PREF{move_tmpfile_instead_of_copying_contents} to 'no'.  These settings slightly change how FileChucker processes the upload internally, and as a side-effect they can sometimes work around certain server issues.  Try all 4 possible combinations of yes and no for these 2 settings.

But for the most part, these problems are all beyond FileChucker's control, and you'll need to ask your hosting company for support with them.  It may be helpful to do a few test uploads from different computers on different internet connections to help pinpoint the source of the problem.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

FileChucker's upload progress bar doesn't work.

FileChucker has been installed on thousands of websites, and its progress bar works properly on the vast majority of them: on both dedicated and shared servers, on Windows, Linux, Mac OS X, IIS, and Apache servers, and virtually every major hosting company around.  On a small percentage of servers, there are Apache filters that interfere with the real-time status information necessary to have a real-time progress bar, and on most of those servers, the problem can be fixed by putting the following lines in the /cgi-bin/.htaccess file:

<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>

(Note: on Dreamhost, those .htaccess lines don't work; but Dreamhost lets you achieve the same thing by unchecking the "extra web security" box in the domain/hosting section of your Web Panel.)

However, on a small percentage of servers, those lines don't fix the problem.  Servers in this tiny minority seem to be doing some kind of write-caching which causes the uploaded file to not really get written to disk until after the whole thing is already uploaded, which makes it impossible for FileChucker to monitor the progress of the upload, and therefore impossible to display a progress bar.

FileChucker isn't doing anything unusual when it uploads files: it uses the standard facilities provided by the CGI.pm module, which is a standard Perl module.  However, FileChucker can also bypass this module and do the upload in a more manual sort of way, by setting $PREF{disable_upload_hook}='yes' in PREFs Section Z in the /cgi-bin/filechucker_prefs.cgi file.  Still, on some servers, neither the standard way nor the manual workaround result in a properly-working progress bar.

If this is the case on your server, you'll need to contact your hosting company, point them to this explanation, and ask if there's anything that they can do.  They can try out the FileChucker demo on this server to see how the progress bar is supposed to work.

Sometimes an outdated Perl installation can cause this problem, so read the note above about outdated Perl versions to find out what your server's running.

Safari users, read the next FAQ item.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

FileChucker's upload progress bar doesn't work in Safari.

Safari seems to be buggy in its handling of file uploads.  HTTP is designed to allow client-server connections to be left open, so they can be re-used, which improves performance; but in Safari, if any such open connections exist, the upload progress bar and the file upload itself will often fail.

The workaround is to set the Connection:close; HTTP header, which FileChucker itself will do, as long as you're visiting filechucker.cgi directly.  If you're using a shortcut URL, then filechucker.cgi's Connection:close; header will not be honored, so you'll need to configure your server to send that header from the page which calls FileChucker.  In Apache-based servers you can do this by adding the following line to your .htaccess file:

Header set Connection close

It's simplest to add that line to your website's top-level .htaccess file, but if you're calling FileChucker from a shortcut URL like yoursite.com/upload/ then you could instead add it to your /upload/.htaccess file.

Finally, if the page FileChucker is on contains images that fail to load, that will often result in connections being left open, which triggers this Safari upload bug.  For example, the images which form the drop-shadow around FileChucker's white inner section will fail to load if you failed to install them on your server during the installation process.  So if you're seeing this issue, be sure you've got the FileChucker images installed.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

I use Network Solutions and I'm having trouble.

It appears that Network Solutions misconfigures their servers as standard practice.  They set the $ENV{DOCUMENT_ROOT} variable to something that isn't really the docroot, which causes problems for web applications like FileChucker.  To fix this, you'll need to determine your real docroot.  Download and install the info.cgi script on your server, and in its output you'll see something like the following:

Environment Variables:
DOCUMENT_ROOT: /usr/services/vux/apache/htdocs
[...]
SCRIPT_FILENAME: /data/14/1/132/68/1617942/user/1723441/cgi-bin/info.cgi

Your actual docroot is the path /data/.../1723441/htdocs (the numbers will probably be slightly different on each server).  So you need to edit your filechucker_prefs.cgi file and, in PREFs Section 02, set the following:

$PREF{uploaded_files_dir} = '/data/14/1/132/68/1617942/user/1723441/htdocs/upload/files';
$PREF{uploaded_files_dir_is_in_docroot} = 'no';
$PREF{uploaded_files_urlpath} = '/upload/files';

Finally, because Network Solutions also often sets the $ENV{SCRIPT_NAME} variable incorrectly, you'll also need to make one small change at the top of your filechucker.cgi file.  Make a backup copy first, and then near the top, you'll see this line:

#$ENV{SCRIPT_NAME} = '/cgi-bin/filechucker.cgi';

You just need to uncomment that line, which means to delete the "#" from the start of the line.  Note that if you're using Windows while editing the filechucker.cgi file, you may need to use Wordpad to edit it, because other editors (particularly Notepad) will mess up the line-endings in the file, causing the server to be unable to execute it.  This problem doesn't affect the filechucker_prefs.cgi file because that's not executed directly.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

FileChucker won't thumbnail a certain image file; or, FileChucker's file-list page gets cut off partway through the list.

This is usually caused by an image file that is partially corrupt.  Image corruption is a matter of degree, and depending on exactly what the corruption is, some apps will be able to ignore or work around it, while others won't.

You can usually fix the image by opening it in an image editor and then re-saving it.

In the case of the file-list page's output being truncated, you'll need to determine exactly which file is causing the problem.  To do that, first take note of the name of the last (bottom-most) file that FileChucker displays successfully.  Then, you can either use the Options Menu to turn off the thumbnails and see which file comes next, or you can log into your server via FTP and see which file comes next.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

What's the biggest file that FileChucker can upload?

FileChucker itself has no limit, other than the $PREF{sizelimit*} settings which you set yourself.  But your server may have other limits, either directly in terms of file size, or indirectly in terms of CPU, RAM, or network limits or issues that cause large uploads to fail.

In general, most servers do not have upload size limits for CGI scripts as they do for PHP scripts; such PHP limits have no effect on FileChucker.  Many clients are using FileChucker specifically for the purpose of uploading large files of several hundred megabytes, and even into the 1-2 gigabyte range in some cases.

Windows/IIS7 servers appear to have a low upload size limit by default (about 30 MB); you'll need to adjust the maxAllowedContentLength setting in your IIS configuration to increase this limit.

If large uploads are failing on your server, in some situations it may help to set the $PREF{disable_upload_hook} setting to 'yes', and/or to set $PREF{move_tmpfile_instead_of_copying_contents} to 'no'.  These settings slightly change how FileChucker processes the upload internally, and as a side-effect they can sometimes work around certain server issues.  Try all 4 possible combinations of yes and no for these 2 settings.

The only currently known hard limits on upload size are:

  • For Apache servers: Apache 1.x, 2.0, and 2.1 cannot accept uploads larger than 2 GB; for that, you must use Apache 2.2.
  • Most (possibly all) 32-bit web browsers cannot upload more than 2 GB.  In our testing, they simply won't respond at all when you hit the "Begin Upload" button with a file larger than 2 GB selected.  In order to upload more than 2 GB at once, you'll need to be running a 64-bit browser, which means you need to be running a 64-bit operating system, which naturally means you must be running 64-bit hardware.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How fast can FileChucker upload files?

FileChucker has no built-in speed limit; it automatically sends data as fast as the network connection will accept it.  The only exception is if your server is running an extremely old version of Perl, or if you've manually set the $PREF{disable_upload_hook} setting to 'yes', in which case there is a delay that you can control via the $PREF{sleep_time_during_nonhook_uploads} setting.

In practice, the limiting factor in most uploads will be the upstream speed limit on the visitor's internet connection.  Most residential internet connections have upload speeds that are only one-tenth or one-twentieth as fast as their download speeds.  As of 2008 in the US, upload speeds are often limited to as little as 32-128 KByte/s (which is 256-1024 kbit/s), even for "broadband" connections.

The server's internet connection is also a factor, but in most cases servers have very fast connections, far faster than the upload speed on the visitor's internet connection.

Sometimes an outdated Perl installation can cause slow uploads, so read the note above about outdated Perl versions to find out what your server's running.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I enable the image features (thumbnails, rotation...)?

First, you need to have at least ImageMagick or GD installed on your server.  Then you need to try enabling the various $PREF{try_to_use_*} settings in PREFs Section 15.

If you have ImageMagick installed, then perhaps the easiest way to get FileChucker's image features working is via the $PREF{try_to_use_convert_*} settings.  Enable those, and that might be all it takes.  Or, you might need to specify the full path to the "convert" command on your server, via the $PREF{convert_command} setting.  If you're running a Windows server, you may run into a problem because Windows includes a built-in convert command which is a disk utility.  So you'll either need to specify the full path to the convert.exe that's within the ImageMagick Program Files folder, or else rename that convert.exe to something else like imgconv.exe, then set $PREF{convert_command} = 'imgconv.exe'.

If you can't get the image features to work using ImageMagick's convert command, then you can try the more traditional method of using either the ImageMagick Perl module or the GD Perl module.  These Perl modules must be explicitly installed on your server; they are NOT automatically installed just because you have ImageMagick itself or GD itself installed.  They are also unrelated to whether you have ImageMagick or GD support in your PHP installation; FileChucker is not a PHP application so anything loaded into PHP is irrelevant.  If you think that you have these Perl modules installed -- or your web host / server admin tells you that they are -- but FileChucker tells you that they aren't, then that means they really aren't.  FileChucker gets its information directly from Perl itself, and if Perl tells FileChucker that the module is not installed, then it's not installed.  The most common sources of confusion here are 1) incorrectly assuming that you automatically have the IM or GD Perl module just because you have IM or GD itself installed, and 2) having multiple Perl installations on the server and having some modules installed under one version of Perl but the script accessing the other, in which case you need to get your Perl situation straightened out and then direct FileChucker to use the correct one (by adjusting the first line in the script).

See also:

Test ImageMagick and GD Perl Modules (and the Convert Command)

Install ImageMagick On Mac OS X

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I add my own fields / text boxes to the upload form?

There are 3 different ways to do this.  The first and simplest way is to use the $PREF{formfield_NN} options in PREFs Section 07.  This is the recommended method and is best in most cases.  You just add a line like this:

$PREF{formfield_01} = 'Your Name';

There are many other options you can specify as well, but that single line is all that's strictly required.

The second way is to use the $PREF{custom_form_fields_*} settings in PREFs Section 07.  This allows you to specify your own fully custom HTML code which FileChucker will include in its output.  You can optionally specify custom file fields in addition to your custom text fields.  You'll still need to tell FileChucker the names of the fields that you'll put into your custom HTML code, so that it knows that it should process them; to do that you can either simply put the names into the $PREF{custom_form_fields_namelist} setting, or you can create a $PREF{formfield_NN} setting for each of the fields, along with a $PREF{formfield_NN_custom}='yes' setting.  See the $PREF{custom_form_fields_*} settings and their documentation for full instructions.

The third way is to use your existing HTML code on an existing page, and then embed FileChucker into that page.  This method is useful when you've got an existing form that's large or complex.  To make this work, you must set $PREF{custom_form_fields_namelist} or $PREF{formfield_NN} as explained in the preceeding paragraph about the second method.  You must also enable $PREF{using_custom_file_elements} and set $PREF{num_custom_file_elements}, but you don't need to set any of the $PREF{custom_form_fields_*} settings.  In the HTML code for your form, you must name your file elements exactly "uploadname1", "uploadname2", etc, and they must have "id" attributes set to those same values.  And if you have any per-file form fields, their names and ids must end in _1, _2, etc.

For this third way, since FileChucker will be submitting the data from your existing form fields, FileChucker will need to wrap its own <form> element around those fields.  This means that when embedding FileChucker into your existing page, you'll actually need to make 2 separate calls to /cgi-bin/filechucker.cgi -- one before your first form field, and the second after your final form field.  (These 2 calls are separate from the ?css and ?js calls that you also need to make.)  For the first of these 2 calls, you must pass ?output=firsthalf to filechucker.cgi, and for the second call you must pass ?output=secondhalf.  For example:

<?PHP virtual("/cgi-bin/filechucker.cgi?output=firsthalf&" . $_SERVER['QUERY_STRING']); ?>
(your form fields here)
<?PHP virtual("/cgi-bin/filechucker.cgi?output=secondhalf&" . $_SERVER['QUERY_STRING']); ?>

A final note for the third way: you must delete your existing <form> and </form> tags, and if you have any <table>s on your page, then you must be careful not to put one FileChucker call inside the table and the other outside of it.  If you're unsure, the safest thing to do is to put the 2 FileChucker calls as far apart as possible.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I enable email notifications, or fix email-sending errors?

The short answer: once you specify a recipient address in the prefs, mail-sending just works, on the vast majority of servers.  In FileChucker, just enable the $PREF{email_notifications_to_webmaster} option and then set $PREF{email_notification_recipient_1} in PREFs Section 06.  There are other settings that you can adjust, but the defaults work fine on most servers.

The long answer: for multiple Encodable web applications including UserBase and FileChucker, the app will automatically try both SMTP and sendmail in order to send email.  On most servers, one or both of those will work by default, so no further configuration is needed.

The default configuration is to use SMTP with the server set to "localhost" because that works on most servers.  However, you may need to change that to the address of the SMTP server provided by your hosting company, or the address of the SMTP server provided by your ISP.

If your SMTP server requires authentication, which it might if you get "relay" errors, then you'll also need to set the SMTP auth preferences.  You'll need to specify the username and password for an email account on the server in question.  On some servers, this requires installing an updated version of the MIME::Lite Perl module.  MIME::Lite version 3.01_05 is known to handle SMTP auth correctly, and you can download this version from here.  Download and unzip that file, then go into the directory lib/MIME/ and you'll see a file called Lite.pm.  On your server, create the directory cgi-bin/perlmodules/MIME/ and upload the Lite.pm file into it.  This fixes SMTP auth issues on many servers.

With newer versions of the applications, you can make it easier to debug email issues by adding the following lines to your prefs file:

$PREF{enable_email_test}	= 'yes';
$PREF{email_test_recipient}	= 'you@wherever.com';
$PREF{email_test_sender}	= 'you@wherever.com';

Then open your browser and visit your installation of the application, and add "?do_email_test" on the end of the URL -- for example www.yoursite.com/cgi-bin/filechucker.cgi?do_email_test.  This will cause the script to send an email using your current email settings, and it'll include those settings in the email, so if and when you manage to get an email to go through, you'll be able to see which settings worked.  For the email_test_recipient and sender addresses, you should use a known-good email account, like your personal email address.

Finally, in some cases you may need to check your spam folder, in case your email system uses overly-aggressive spam filtering which causes good emails to be flagged.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I add an email field and send a notification email to the entered address?

First enable email notifications in PREFs Section 06, including the $PREF{email_notifications_to_userEntered_addresses} setting; then add a set of $PREF{formfield_NN} options in PREFs Section 07 like this:

$PREF{formfield_01}		= 'Your email address:';
$PREF{formfield_01_shortname}	= 'email_address';
$PREF{formfield_01_email}	= 'yes';

By default, these user notification emails don't include links to the uploaded files, nor the contents of any form fields.  To include those, add the variables %%filelist%% and %%formfields%% to the $PREF{user_notification_email_template} setting.  You may want to look at the $PREF{webmaster_notification_email_template} setting to see how those variables are included there by default.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I make my form fields appear in the notification email?

In newer versions of FileChucker, all form fields are included by default in the webmaster emails (and can be added to the user emails) via the %%formfields%% variable in the email templates.  But if you want to add individual form fields: the form fields that you added are in PREFs Section 07, and each one of them has a _shortname, for example you might have:

$PREF{formfield_01}		= 'Company:';
$PREF{formfield_01_shortname}	= 'company_name';

What you need to do is add those shortnames as variables to the email template, which is in PREFs Section 06, named $PREF{webmaster_notification_email_template} (or $PREF{user_notification_email_template}).  So for the company_name field, you'd add the variable %%company_name%% to that template.

However, if the form field in question is a per-file form field -- that is, if you've set $PREF{formfield_NN_position} = 'perfile' for it -- then you need to add the %%company_name%% variable to the filelist template instead, which is named $PREF{webmaster_notification_email_filelist_template} (or $PREF{user_notification_email_filelist_template}).

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I use one FileChucker for multiple forms/pages on my site?

There are two ways to do this.  The first way is to simply create a second copy of your filechucker.cgi and filechucker_prefs.cgi files.  You can name the copied files whatever you'd like as long as the prefs file matches the main script, for example you could name them "fc2.cgi" and "fc2_prefs.cgi".  The fc2.cgi script will not load the filechucker_prefs.cgi file unless there is no fc2_prefs.cgi file; so the fc2.cgi & fc2_prefs.cgi files are a totally separate installation that you can configure and customize independently.

The second way would be to use the $PREF{other_prefs_files} settings in PREFs Section Z of your filechucker_prefs.cgi file.  This method uses a single filechucker.cgi file with multiple prefs files.  See the documentation with the $PREF{other_prefs_files} settings for the full instructions.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I get direct-download links instead of CGI-based download links?

The most common cause for the CGI-based download links is setting $PREF{groups_allowed_to_download} to something other than 'public'.  In order for FileChucker to check for membership in the specified group, it must route the download through itself, rather than providing a direct link to the file.  In most cases, it's sufficient to set $PREF{groups_allowed_to_list_files} to a non-public group, because this prevents unauthorized users from viewing the downloads page (i.e. the file list) in the first place.  It's generally difficult to download files without seeing the file list first.

There are other settings that cause FileChucker to use CGI-based download links, though; for example, $PREF{log_all_downloads} and $PREF{send_download_notification_emails}.  Any feature that requires FileChucker to perform some action upon download will of course require FileChucker to be aware of the download, which means it can't use direct links.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I set or reset my password?

How can I hide or password-protect certain features?

By default there is no password.  To create a password, you must generate a new hash for it, by going to http://yoursite.com/cgi-bin/filechucker.cgi?newpw and entering your new password.  Then take the resulting hash and enter it into one of the $PREF{admin_password_hash} or $PREF{member_password_hash} settings in PREFs Section 03.

By default most features are public; to change that, go to PREFs Section 03 and find the list of groups_allowed_to PREFs:

$PREF{groups_allowed_to_upload}		= 'public';
$PREF{groups_allowed_to_list_files}	= 'public';
$PREF{groups_allowed_to_delete_items}	= 'public';
...

Simply change the feature in question from 'public' to 'member' or 'admin'.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I integrate FileChucker with UserBase?

First install UserBase, then in your filechucker_prefs.cgi file, enable $PREF{integrate_with_userbase} in PREFs Section 03.  Then, in the same section, you'll probably want to change most/all of the $PREF{groups_allowed_to_*} settings from 'public' to 'member'.  Finally you may want to set $PREF{enable_userdirs} in PREFs Section 04.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I give each of my users their own private uploads folder?

FileChucker itself does not handle usernames, so you'll need a login application like our UserBase login system for this.  UserBase allows you to create individual user accounts for each of your users, and then FileChucker can integrate with UserBase to support those accounts.  So install UserBase, then in FileChucker you'll want to set $PREF{integrate_with_userbase} in PREFs Section 03 and $PREF{enable_userdirs} in PREFs Section 04.  You'll also need to keep $PREF{enable_subdirs} set to 'yes' in PREFs Section 05.  Finally, for the $PREF{groups_allowed_to_*} settings which are set to 'public', you'll probably want to change those to 'member', in PREFs Section 03.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I specify custom folder permissions?

Turn on the $PREF{enable_custom_folder_permissions} setting in PREFs Section 03.  Then, while logged in as admin, go to the downloads page.  Each folder in the list has an "options" link which opens a menu, and on that menu there is a "Permissions" link.  That allows you to specify custom permissions on a per-folder, per-user, and per-group basis.

Note that in most cases you should not attempt to set any custom folder permissions for the "users" folder nor any of the individual userdirs within it.  If you want to use userdirs (see the previous item) and custom folder permissions on the same installation, create top-level folders next to the "users" folder (not inside it) and specify your custom folder permissions on those; then disable the $PREF{navigate_users_into_userdirs_automatically} setting, and also make sure that the $PREF{groups_allowed_to_view_top_level_of_download_page} setting includes the "member" group.  This will allow each of your members to use his own private userdir, plus any top-level folders for which your custom folder permission settings give him access.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

Can I make FileChucker work with my existing login system?

UserBase is generally the best login system to use with FileChucker.  However, as long as your server's PHP configuration is not too crippled, you can usually make FileChucker work with an existing PHP login system.

First you need to figure out how to make your PHP login system tell you the username of the logged-in user.  This will be different for each different login system, but for the purposes of this guide let's assume that the following PHP code will get the username from your login system:

<?php
$username = get_the_username();
?>

Joomla users: according to the Joomla documentation, the following should work for you:

<?php
$username = '';
$user =& JFactory::getUser();
if(!$user->guest)
{
	$username = $user->username;
}
?>

Once you've got the username, the next requirement is that you call the filechucker.cgi script from your PHP page using the call_filechucker.php method as explained in step #5 (method B) of the instructions.  That will work on most servers, but unfortunately some hosting companies cripple their servers by disabling PHP's exec() function.  If you're stuck on a server like that, you'll need to either use UserBase, or switch to a better hosting company.

The next step is to set some environment variables from your PHP $username variable; FileChucker will then be able to read those env vars.  So your full PHP code should now look like this:

<?php
$username = get_the_username();
putenv("PHP_ENC_USERNAME=$username");
putenv("PHP_ENC_USERDIR=$username");
require($_SERVER['DOCUMENT_ROOT'] . "/call_filechucker.php");
?>

The last step is to configure FileChucker to use those environment variables.  To do that, edit your filechucker_prefs.cgi file and enable the following settings:

# PREFs Section 03: Security.
#######################################################
#
$PREF{integrate_with_existing_login_system} = 'yes';
$PREF{enable_username_from_php_session} = 'yes';


# PREFs Section 04: User-directories.
#######################################################
#
$PREF{enable_userdirs} = 'yes';
$PREF{enable_userdir_from_php_session__method1} = 'yes';

Of course $PREF{enable_userdirs} -- FileChucker's private folders feature -- is optional; you can enable the login functionality without enabling userdirs.  But in most cases people use them together.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I pass external data to FileChucker?

You can include external data within any of FileChucker's $PREF settings by using the following syntax:

%COOKIE{cookie_name}
%URL{url_variable_name}
%ENV{environment_variable_name}
%SQL{{sql_select_statement_here}}
%PREF{other_pref_name_here}

For example, if you wanted to adjust FileChucker's title by passing ?customtitle=MySpecialTitle on the URL, you would set the $PREF{title} setting (in PREFs Section 07) like this:

$PREF{title} = '%URL{customtitle}';

Of course, your users can modify their URLs and even their cookie values, so you shouldn't use the URL nor cookies for passing any sensitive data.

To use environment variables to pass your own data from a PHP page to FileChucker, you must call FileChucker from your PHP page using the call_filechucker.php method as explained in step #5 (method B) of the instructions.  Then in your PHP page, just before calling FileChucker, use putenv() to set your variables.  On most servers the environment variable name that you create must start with "PHP", so for example:

<?php
$somevar = what_ever(); // set your variable however you want to.
putenv("PHP_SOMEVAR=$somevar"); // put your variable into an environment var.
require($_SERVER['DOCUMENT_ROOT'] . "/call_filechucker.php");
?>

Then in your filechucker_prefs.cgi file, in whichever $PREF you're adjusting, you would use %ENV{PHP_SOMEVAR} to get the value of that variable.

 

FileChucker (sometimes) says I'm not logged in, when I really am!

When this happens, it's often in response to having clicked on a link within a notification email.  It's usually caused by the URL either having, or not having, the "www." in front of your domain name.  Try adding or removing the "www." and see if that fixes things.

The root cause of this problem is the way that web browsers handle cookies.  A cookie set by http://yoursite.com/ cannot be read by http://www.yoursite.com/ and vice-versa, because technically those are different domains for security purposes.  There's no way for an application like FileChucker to override this security setting and read the other domain's cookies.

Instead, to fix the problem, you need to configure your website itself to pick one form and stick to it: either always use http://yoursite.com/ without the "www.", or else always use http://www.yoursite.com/ with the "www."  Then if someone visits the "wrong" one, the website will automatically and transparently send the visitor to the "right" one.  To do this, check with your hosting company's control panel; Dreamhost for example has a simple setting for this that you can toggle.  If your hosting company doesn't, and your website runs Apache, then you can add a few lines to your main .htaccess file to make it happen:

# Use this to automatically redirect www.you.com to just you.com:
#
RewriteEngine On
RewriteCond %{HTTP_HOST}   ^www\.you\.com [NC]
RewriteRule (.*)           http://you.com/$1 [L,R]

# Or, use this to automatically redirect you.com to www.you.com:
#
RewriteEngine On
RewriteCond %{HTTP_HOST}   ^you\.com [NC]
RewriteRule (.*)           http://www.you.com/$1 [L,R]

If you use this code, you don't need to go back into your individual pages and update your links to add/remove the "www." on each one.  The .htaccess code will automatically do that for you, whenever someone visits the wrong domain.  And it will keep the rest of the request intact, so even if the link is a long URL to some page deep within your site, that's no problem: it'll just add or remove the "www." and leave the rest of the URL unchanged.

[ TopFileChucker HomepageInstructionsDownloadPurchase ]

 

How do I ...

Here are the prefs & sections for some of the most commonly-asked configuration questions.  Just find the appropriate section/pref in your filechucker_prefs.cgi file and then change its setting.

To make FileChucker use your shortcut URL (mysite.com/upload/):

# PREFs Section 02: Paths and Directories.
#
$PREF{here}				= '/upload/';

To hide the path to your uploads directory:

# PREFs Section 03: Security.
#
$PREF{hide_path_to_uploads_dir}		= 'yes';

To disable the form fields that allow the user to choose/create a subdirectory for their uploaded file:

# PREFs Section 05: Subdirectories.
#
$PREF{display_dropdown_box_for_subdir_selection}	= 'no';
$PREF{enable_manual_creation_of_new_subdirs_during_upload}= 'no';

To change the text appearing at the top of the page:

# PREFs Section 07: Upload Form Configuration.
#
$PREF{title} = '<div id="title">FileChucker</div>';
$PREF{intro} = qq`<p style="text-align: center;">Upload some files!</p>`;

To change the max/default number of files to be uploaded:

# PREFs Section 08: Upload Restrictions.
#
$PREF{max_files_allowed}		= 5;
$PREF{num_default_file_elements}	= 1;

To change the limit on how big an upload can be:

# PREFs Section 08: Upload Restrictions.
# Note: 1024*1024*30 is 30 MB, 1024*1024*50 is 50 MB, etc.
#
$PREF{sizelimit_for_strangers}		= 1024*1024*30;
$PREF{sizelimit_for_members}		= 1024*1024*50;
$PREF{sizelimit_for_admins}		= 1024*1024*80;

To limit the kinds of files that can be uploaded/displayed:

# PREFs Section 08: Upload Restrictions.
#
$PREF{only_allow_these_file_extensions}		= '';
$PREF{disallow_these_file_extensions}		= '.exe .php .cgi';
$PREF{allow_files_without_extensions}		= 'yes';
$PREF{disallow_these_strings_within_filenames}	= '\.exe \.php, \.cgi';

To send the upload information to another page after upload is complete:

# PREFs Section 10: Post-Upload.
#
$PREF{after_upload_redirect_to}		= 'http://mysite.com/mypage.php';
$PREF{pass_original_querystring_through}= 'yes';
$PREF{pass_filenames_on_redirect}	= 'yes';
$PREF{pass_formfield_values_on_redirect}= 'yes';

[ TopFileChucker HomepageInstructionsDownloadPurchase ]