Home → Admin Manual → HelpSpot Hacks → Converting Attachments from Database Storage to File System
12.1. Converting Attachments from Database Storage to File System
HelpSpot allows the option to save all request file attachments in the database. This makes for easy backups. However, on some high volume installations or installations which deal in many large attachments it's better to save the attachments to disk to prevent the database from becoming unwieldy.
Moving to File System Storage
- Create a directory to store attachments in. This directory should be outside the web root and writable by the web server.
- In Admin->Settings->System change Attachment Storage Location to "Server File System"
- In the box that appears (Attachment File System Directory) put the full path to the directory you created
- Save the settings
Converting Database Stored Attachments to the File System
By default, after the change above HelpSpot will store new attachments to the file system, but old attachments will continue to be stored and served from the database. On version 4 and greater you can use the HelpSpot command attachments:tofile
If you'd like to convert these old attachments on HelpSpot version 3 to the file system you can use the script linked below do to so. To use the script:
- Download the script below, move it to the root HelpSpot folder. This is the one with config.php in it. If using FTP to move the file be sure to force binary mode.
- Backup your database (seriously)
- Place HelpSpot in maintenance mode to prevent new requests while the script runs (Admin->Settings)
- From the command line do "/path/do/php -f /path/to/convert_attach_from_db_to_file.php"