# Upgrading Easy Forms ¶

## Introduction ¶

This document describes how to upgrade your Easy Forms application from 1.x to 1.18.2.

If you encounter errors during this process:

1. Note any error messages you see (take a screenshot or copy your logs).
2. Restore your site to its previous state, using the file and database backups you created before you started the upgrade process. Do not attempt to do further updates on a site that had upgrade problems.
3. Contact us via our support page on CodeCanyon.

> Note: All directories mentioned in this document are relative to your Easy Forms installation directory.

## Upgrade Steps ¶

1. Make a full backup of files, directories, and your database before starting, and save it outside your Easy Forms installation directory.
2. Remove all old files and directories, except the followings:
   - `config/db.php`: Stores the database configuration.
   - `static_files/uploads`: Stores files uploaded by your users when they submit their forms. Also, this folder stores the uploaded files by registered users (avatars and themes). All files that are not part of the app should be hosted within this folder.
   - Any custom directory or file you added elsewhere.
3. If you made modifications to files like `.htaccess` or `robots.txt` or `config/params.php`, you will need to re-apply them from your backup, after the new files are in place.
4. Upload the latest Easy Forms release to your Easy Forms directory, except for the following files and directories:
   - `config/db.php`
   - `static_files/uploads`
   - Note: With the following steps you will avoid problems (corrupted files) and reduce the upload time to a couple of minutes.
     1. Compress the 'app' folder
     2. Upload the 'app.zip' file to your server.
     3. Extract the 'app.zip' file with the cPanel File Manager.
5. Re-apply any modifications to files such as .htaccess or robots.txt or config/params.php. And, if you are using IP Geolocation, don't forget to re-upload the GeoLite2 DBs.

6. Run the Update script by visiting http://www.example.com/update (replace www.example.com with your domain name). This will update the database tables. If you are unable to access the update script, do the following:

   - Open `config/web.php` with a text editor.
   - Find the line that says: `// 'update' => ['class' => 'app\modules\update\Module'],`
   - Uncomment this line by removing the ‘//’ characters. `'update' => ['class' => 'app\modules\update\Module'],`
   - Run the Update script.
   - When you finish the update process, comment the same line again.

7. Try to run the update script again and make sure a ‘Page not found’ error message appears.

8. Special Step: To update forms created before v1.14 go to Site Settings -> Performance -> Update Form Builder fields -> Click Update.

Note: Current `static_files/uploads` folder structure:

    - `app`: Stores the uploaded application files.
        - `site`: Stores the uploaded files related to the site.
    - `forms`: Stores the files uploaded by the Forms.
        - This folder contains an .htaccess file and web.config file that restricts the file access to logged-in users only.
        - Take into account that each form stores its files in a numbered sub-folder, based on the Form ID. For example, the Form with ID: 1, stores the files into the `static_files/uploads/forms/1` sub-folder.

And that’s it! The upgrade is now complete. Your upgraded Easy Forms application is now ready to use. Enjoy!

> Note: We always suggest updating the app on a test copy of your site before applying it to your live site. Even minor updates can cause your site's behavior change.