# Editor > How to open and edit text files in DooFiles: the code editor, saving with Ctrl+S, the PHP syntax check, the password for code files, changes made by someone else, previous versions, and the preview of Markdown, HTML and JSON files. Source: https://doothemes.com/docs/doofiles/files/editor --- ## Overview DooFiles opens text files in a code editor with syntax highlighting, the same editor that WordPress uses for themes and plugins. To open a file, click its name in the list, or right-click it and choose **Edit**. Before you save, DooFiles checks the syntax of PHP files, asks for your password when the file is code, warns you if someone else changed the file, and keeps the previous version as a backup. [SCREENSHOT_HERE: The DooFiles editor with a PHP file open, the file name and UTF-8 in the header, and the Preview, Versions, Download, Close and Save changes buttons] ## Which files open in the editor The editor opens text files, such as PHP, JavaScript, CSS, HTML, JSON, Markdown, XML or plain text, up to the size set in **DooFiles › Settings** (2 MB by default). See [Limits](https://doothemes.com/docs/doofiles/settings/limits). Other files open differently: - **Images, videos and PDF files** open in the [media viewer](https://doothemes.com/docs/doofiles/files/media-viewer). - **Zip files, fonts, Office documents and other binary files** cannot be edited. You can download them. - **Files that are not UTF-8 text** cannot be edited safely. You can download them. When a file cannot be changed, because DooFiles is in [read-only mode](https://doothemes.com/docs/doofiles/security/read-only-mode) or the server does not let it write the file, the menu shows **View** instead of **Edit**, and the header of the editor says why. ## The editor screen | Element | What it does | |---|---| | **The header** | The name of the file and its encoding, such as *UTF-8*. It also shows *Unsaved changes*, *Not writable* or *Read-only mode* when they apply | | **Preview** | Shows the preview next to the code. Only for Markdown, HTML and JSON files | | **Open on the site** | Opens the HTML file in your site, in a new tab. Only for HTML files | | **Versions** | Lists the previous versions of the file, to restore one | | **Download** | Downloads the file | | **Close** | Goes back to the folder | | **Save changes** | Saves the file | ## Save your changes Click **Save changes**, or press **Ctrl + S** (**Cmd + S** on a Mac). DooFiles shows *File saved.* When it keeps a copy of the previous version, it says *File saved. The previous version was kept as a backup.* If you try to leave the editor with unsaved changes, DooFiles asks first: *Leave without saving?* ### The PHP syntax check Before saving a PHP file, DooFiles checks its syntax without running it: - **If there is an error**, the file is not saved. DooFiles shows *The file was not saved.*, the error with its line, and a **Go to line** button that takes you to it. Fix it and save again. - **If PHP only reports warnings**, for example about something deprecated, the file is saved, and DooFiles shows them under *Saved, but PHP reported:*. This keeps a typo from breaking your site. The check needs the PHP tokenizer extension. See [Requirements](https://doothemes.com/docs/doofiles/requirements). ### Files that ask for your password Saving some files asks for your WordPress password first, because they run code or change how your server works: - **PHP files**, and any file with a PHP extension anywhere in its name. - **Server and configuration files:** `.htaccess`, `.user.ini`, `php.ini`, `web.config`, `wp-config.php` and `.env`. The editor tells you in advance: *Saving this file asks for your password.* After you confirm it, code changes do not ask again for a while (10 minutes by default). See [Password confirmation](https://doothemes.com/docs/doofiles/security/password-confirmation). ### When the file changed on the server If the file changed after you opened it, for example because someone else saved it, a plugin updated it or you changed it by FTP, DooFiles does not overwrite it silently. It shows *The file changed on the server* and lets you choose: - **Save anyway** replaces the server version with yours. The server version is kept as a backup. - **Cancel** keeps the server version. Copy your changes, close the editor and open the file again to see the new version. ## Previous versions Every time you save a file, DooFiles keeps a copy of the version you replaced. Click **Versions** to see them, newest first, and **Restore** to go back to one. DooFiles asks first, and keeps the current version as a backup too, so a restore can also be undone. See [Backups](https://doothemes.com/docs/doofiles/files/backups) for how many versions are kept and for how long. ## Preview Markdown, HTML and JSON files have a preview next to the code. Click **Preview** to show it or hide it. - **Markdown** shows the formatted text, with its headings, lists, tables and links. - **HTML** shows the page as a browser draws it. Scripts do not run in the preview. To see the page with its scripts, click **Open on the site**. - **JSON** shows the data as a tree that you can open and close. **Expand all** and **Collapse all** open or close every level, long lists show 100 items at a time, and numbers appear exactly as they are written in the file. If the JSON is not valid, the preview says *This is not valid JSON.*, with the line and column of the error and a **Go to the error** button. To change the width of the preview, drag the divider between the code and the preview, or use the arrow keys on it. Double-click the divider to go back to half and half. DooFiles remembers the width in this browser. To open the preview every time you open one of these files, turn on **Open the preview when editing** in **DooFiles › Settings**. See [This browser](https://doothemes.com/docs/doofiles/settings/this-browser). [SCREENSHOT_HERE: A JSON file in the editor with the tree preview on the right, some levels open, and the Expand all and Collapse all buttons] [SCREENSHOT_HERE: A JSON file with an error, with the preview showing This is not valid JSON, the line and column, and Go to the error] ## Troubleshooting | Problem | What to do | |---|---| | *This file is 3.4 MB. The editor opens files up to 2 MB; you can download it instead.* | Download the file, or raise **Largest file the editor opens** in [Limits](https://doothemes.com/docs/doofiles/settings/limits) | | *This is not a text file, so it cannot be edited here. You can download it.* | The file is binary, such as an image or a font. Download it to change it on your computer | | *This file is not UTF-8 text, so it cannot be edited safely here. You can download it.* | Download the file, convert it to UTF-8 in your editor, and upload it again | | *The file was not saved.* with a PHP error | Click **Go to line**, fix the syntax error and save again | | The menu shows **View** instead of **Edit** | DooFiles is in read-only mode, or the server does not let PHP write the file. Check its permissions with your hosting provider | | *The file changed on the server* | Someone else saved the file after you opened it. Choose **Save anyway** to keep your version, or **Cancel** to keep theirs | | Saving asks for my password every time | The confirmation lasts 10 minutes by default. Change it in [Password confirmation](https://doothemes.com/docs/doofiles/security/password-confirmation) | Need more help? [Open a support ticket](https://doothemes.com/account/tickets/new).