Archive for the ‘Ajax File Browser’ Category

Change the maximum upload size with PHP

Depending on how you host your website (or application) there are different ways to change the PHP settings. In particular, the most asked about problem, changing the maximum upload size.

There are 3 settings PHP uses that limit your uploading ability:

  • post_max_size
    This is the combined maximum size of all files sent on the form. If you have 2 file fields on your form, the total filzesize of the 2 files must not exceed the post_max_size value.
  • upload_max_filesize
    This is the filesize limit of each individual file.
  • memory_limit
    PHP scripts have a memory limit, and generally speaking this can prevent some uploads from working. The limit should be set at a reasonable level, of course you won’t need 20mb for a simple ‘hello world’ script. Try slowly increasing this value if you find that uploads still aren’t working.

If you host your site remotely, you should check their documentation on how to change the PHP configuration settings. But if you’re not so inclined, and prefer a trial and error approach, here’s a summary of things to try:

Change php.ini directly

If you host your site on a server that you have access to, you can change your php.ini file directly. This is the easiest approach. Your php.ini file should exist in the PHP installation directory. Open it in your favourite text editor and search for these lines and change them:

memory_limit = 8M
post_max_size = 8M
upload_max_filesize = 2M

You may need to restart apache for the changes to take effect.

Changes to .htaccess

.htaccess files only apply to Apache webservers. They are files that append and change certain values that apache uses and they are placed in the root folder (and all folders beneath will use those settings). If apache uses PHP as a Module, then you can add values to the .htaccess file:

php_flag file_uploads On
php_value memory_limit 8M
php_value post_max_size 8M
php_value upload_max_filesize 2M
 

Download this code: .htaccess.txt

If you try this approach, and your webserver displays a 500 interal server error, then PHP is not runing as a module and apache didn’t like the php_value entries. You will need to remove your changes.

Upload a php.ini file

This generally works if the changes to .htaccess method doesn’t. Some web hosts that use apache, also use PHP as a CGI. Then also, most times, this allows changes to the PHP configuration using a custom php.ini file that you can upload. You don’t want to include every setting available to PHP in your file. Only include the ones you want to change, and don’t forget the heading [PHP]:

[PHP]
; Whether to allow HTTP file uploads.
file_uploads = On
; Maximum amount of memory a script may consume (8MB)
memory_limit = 8M
; Maximum size of POST data that PHP will accept.
post_max_size = 8M
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M 

Download this code: php.ini

Still not working

In the event these techniques didn’t work for you, check with your host’s documentation.

18 Comments »

Ajax File Browser 3 Beta

Lately I’ve had some time to finally keep my promise to make a better AjaxFB.

I’ve also moved the downloads to Sourceforge, in a hope to better keep a track of bugs and other support issues.

The new version has a lot of neat stuff, and fixes a lot of bugs. Here’s a demo, give it a try.

The software is also available for download, but because it’s in beta (and even if it wasn’t) I take no responsibility for how you use or misuse the application or for any damage to or loss of files etc.

There is no documentation yet, but there are little hints here and there.

PS: I haven’t updated the official AjaxFB site yet, so you won’t find any information there.

46 Comments »

Ajax File Browser has it’s own site

The example that turned into demand now has it’s own site.

ajax.jc21.com is now the home of the latest release and demo, with some FAQs thrown in for good measure.

2 Comments »

PHP Ajax File Browser 2.0.1

A new version of PHP Ajax File Browser is now available. It fixes two major problems:

  • Fixed normal user account admin priveleges bug
  • Fixed accented characters prevented from listing. Still has some display problems in IE6.

Download

Technorati: ajax, php, javascript, web 2.0

37 Comments »

PHP Ajax File Browser 2.0 Beta

Update: Version 2.0.1 is available. Update post found here.

After the success of the PHP Ajax File Browser V1.1, I’ve re-invented the wheel with this new version. It’s not just a simple file browser anymore!Public Front endHere’s a list of features (some were already present in 1.1):

  • Easy to use interface
  • Allows public or restricted users to download anything you allow
  • Share directories do not have to be beneath the site root
  • Permissions: List, Download, Upload and Delete
  • Administration Area for easy maintenance
  • Simple self installation script
  • Display extra links
  • Logs everything to a Mysql database
  • Reports on downloads, clickthrus, everything.
  • Theme Support
  • Block certain filetypes, filenames and directories
  • Small page weight

Note: This is a beta. It will have bugs. Use at your own risk. I use it, so it can’t be that bad ;) But I do take no responsibility for loss of data etc etc. Also, I hope that you’re wise enough not to share the site directory of this application, or people could download your config files and get your passwords.

Administration AreaInstallation

Just unzip to a directory somewhere on your webserver, and point to index.php. Installation will ask you for details from there. The application does not need to be at the root of your site (anymore).

So, where do you get it?

Please report bugs and suggestions here. See below for a list of compatibilities.

Op System Webserver PHP Mysql Result
Windows Apache 2 5.1.4 5.0.22 OK
Linux Apache 2 4.4.3 4.1.21 OK
Op System Browser Result
Windows Firefox 1.5 OK
Windows Firefox 2 OK
Windows IE 6 OK
Windows IE 7 OK

If you have had success or failure with other combinations please let me know – particularly non Windows browsers.

Known issues

Contributor Problem
Rutger Files and directories with accented characters such as ‘é’ and other like ‘ø’ cause the application to hang when retrieving a directory listing. Resolved in 2.0.1

Technorati: ajax, php, javascript, web 2.0

35 Comments »

PHP Ajax File Browser

New Version: Ajax File Browser 2.0 Beta, this version is no longer supported.

As the new buzz technology is developing, I realised I had no real evidence that I infact know how to use it. Coupled with the need for an intranet file server application, I decided to make an Ajax version of a Server File Browser.

Initial Screen Using the Sarissa ajax library, this handy application only has a page weight of 71kb! Directory listings are limited to 30 files/folders per page, so the ajax requests are quite quick. Additionally, the application has been tested on Firefox and IE 6 only. Please leave me a comment if you have bugs with other browsers.

All shared files can be downloaded, and are force saved. Meaning that you can even share your PHP source files, without letting them be compiled first.

Application Configuration

After downloading the application, unzip the contents to a directory on your webserver. This application has been designed for a host where the php document root is the root path of the application. So, it cannot work under a sub-directory of a domain or host name. You may want to look into sub-domains if this affects you.

The application requires no database (although may do so in future, to log downloads etc). There is only one configuration file, config.inc.php. In this file there are two main settings:File Browsing

  1. Shares
    Paths to directories on the server. They do not have to exist as a sub-directory of the application, they can exist relatively or absolutely. So long as the web service has permissions to the directory, you can browse it. This is the biggest reason why I had to write my own application. Others on the net simply didn’t allow complete server browsing. You must be careful not to share anything crucial or anything that will compromise server security. Once a directory is shared, all sub-directories will also be shared.
  2. Blacklists
    You can exclude certain directory names, file names, and even file extensions from being viewed. I was also going to include something about hidden or system files aswell, but I got lazy :)

Apache vs Other Servers

Included in this package is a .htaccess file for Apache servers. It’s main directive is to prevent PHP’s short open tags. If you have an error with the htaccess file (as some servers will not allow php values in them) then you will have to make arrangements to prevent the short open tag in another way. The short open tag will affect the XML documents returned with the Ajax calls. This directive is now irrelevant in v1.1

Demo and Download

Changelog

  • 2006-09-15 v1.1, No need for short_open_tag anymore

Technorati: ajax, php, javascript, web 2.0

34 Comments »