Thursday, August 30, 2012

An openupload installation better explained

If you're not familiar with it, openupload is an open-source, web-based, file-sharing system kind of like a rapidshare or mediafire. It's written in PHP and will run fine on a LAMP server. There hasn't been any new versions published since November 2010, but I'm still able to run in on the Ubuntu 12.04.1 without any changes. It appears to be highly recommended on Sourceforge, and so far so good for my setup once I was able to get it to actually work.

I had my fair share of problems getting openupload to run using my limited knowledge of PHP and Linux, but  after roughly following this guide I was able to get it working will be rolling it out as an FTP alternative at my workplace. The lack of setup documentation was one of the frustrating problems I ran across though, so I'm going to share what I've been able to put together in order to hopefully make your install easier.

First, to preface the documentation, here's a little bit of information about my setup. As I said, I'm running this on Ubuntu 12.04.1 server (64-bit), with PHP 5.3.10, MySQL 5.5.24, and Apache 2.2.22.

Following the guide mentioned above, I was able to get the basic installation working for the admin user. However, there were still issues with downloading, and also with any non-admin user. This problem is in the the permissions system of openupload. You will likely have to change it to accommodate your setup. You can do this through the site administration (Administration->Rights, then select the group you want to change), or else you can manually edit the MySQL table, but I'd suggest using the administration tool. To do it during setup, the INSTALL file mentions the different modes available. Pick the mode you want, and then go into the sql/txt/modes directory and find the corresponding permissions file. Copy that file (e.g. acl_restricted.txt) to your sql/txt/ directory, overwriting the acl.txt file. Otherwise you can modify the permissions after the setup using either method mentioned above. The bolded text is the table names that control the permissions. For the rest to make sense you may have to look at the table in MySQL first, and then you should get it:


  • id - is the primary key and is set manually
  • module - refers to the modules of the site, with values of admin, auth, and files
    • admin refers to site administration privileges, which should only go to the admin group
    • auth is for allowing users to do stuff, or not to
    • files refers to the uploading, downloading, or deleting of files
  • action - sub-categories of the modules to be more specific about the permissions
    • admin actions
      • not sure. The admin group uses the wildcard * to allow all
    • auth actions
      • login - whether the group can login or not, which should always be allowed
      • logout - whether the user can click logout, which should be allowed
      • profile - whether the user can view and change his or her profile
      • register - whether a user can register themselves or not
    • files actions
      • d - whether the group can download files
      • u - whether the group can upload files
      • r - whether the group can remove files
      • l - whether the group can view their files. This enables the My Files tab
  • group_name - which group the acl pertains to
  • access - either allow or deny
The plugins work the same way. You can modify them in the administration settings (Administration->Plugins->Plugins ACL), or direct in the MySQL

  • id - is the primary key and is set manually
  • group_name - specifies which group the acl pertains to
  • plugin - specifies which of the optionally installed plugins the acl pertains to
    • password - allows users to force password entry before file download is allowed
    • captcha - allows users to force a captcha entry before file download is allowed
    • email - allows users to have emails sent to notify of loaded files, removal links, etc
    • mimetypes - Allows restricting uploads by mime type by group
    • compress - another ?. I'm guessing this enables some type of invisible compression algorithm
    • expire - Enables auto-expiration of links after 30 days. Possibly automatic file deletion as well
If you know of other permission settings I'm missing, please add them in the comments. These are the ones I've figured out or found, and they were enough to get everything working as I need it to.

If you're using plugins, you may also need to change the related options. You can do that in the administration under Administration->Plugins->Plugins Options.

Now, you may also want to modify or rebrand the site to better fit the look you want. This is mentioned breifly in the documents, suggesting you create a new site template and change the configuration file to point to that directory rather than the default template, so it's up to you. Here are where files are located, with the directories based on starting in your web directory of the openupload install:

  • Openupload config file - contains all the main application settings (db information, site template and directory mappings, etc)
    • [openupload directory]/www/
  • Main page html file - in case you want to add links or anything to the main page
    • [openupload directory]/templates/default/index.tpl
  • Main CSS file - for modifying the background, alignment of objects, colors, etc
    • [openupload directory]/www/templates/default/main.css
  • Logo image - the logo that displays in the upper-left corner
    • [openupload directory]/www/templates/default/img/openupload.jpg
  • Email template - this is the default template used when sending notification emails
    • [openupload directory]/templates/default/plugins/email/notify.tpl
The [openupload directory]/templates/default/ directory contains the HTML pages for essentially the entire site.

If you run into problems uploading a file, make sure to check the upload size limits. This is set in the config file and your php.ini file. You'll want to make sure that the HTTP POST limit and the max upload size in your PHP settings match, and that the [openupload directory]/www/ also matches that value. By default, the PHP settings allow only 2MB files.

I hope that helps you get started with openupload. There's also another one out there called FileZ, but I haven't tried using that and only mention it in case you want to look into an alternative that has more recent development.