File Manager Basics: How to Upload and Edit Files Directly on Your Server.

PalmHost Logo

File Manager Basics: How to Upload and Edit Files Directly on Your Server

Once you have secured your domain registration and activated your hosting account, the next logical step is getting your website online. While installing a Content Management System (CMS) like WordPress is a popular choice, many web designers and business owners prefer to build custom HTML, CSS, or PHP websites from scratch. To bring these custom creations to life, you need a reliable way to transfer files from your local computer to your live server.

Historically, developers relied heavily on complex FTP (File Transfer Protocol) client software to move data. However, modern standard web hosting environments offer a much faster, integrated solution. The cPanel File Manager is a powerful, browser-based application that allows you to upload, extract, move, and edit your website files directly within your dashboard. It acts much like the Windows Explorer or macOS Finder you already use daily, but it controls your cloud infrastructure.

This comprehensive guide will explore the essential functions of the cPanel File Manager, explaining how to navigate your directory structure, upload large website archives, and make rapid code edits securely without ever needing third-party software.

Navigating the Directory Structure: Where Do My Files Go?

The most common mistake beginners make is uploading their website files to the wrong folder. If your files are not in the exact directory that the server expects, your domain will simply display a blank page or an "Index of /" error. Understanding the server's directory layout is crucial.

  • The Home Directory ( /home/username/ ): This is the absolute root of your hosting account. It contains critical system folders for your email hosting data, SSL certificates, and server logs. Never upload your website files directly here, as they will not be visible to the public internet.
  • The Document Root ( public_html ): This is the most important folder on your server. It acts as the public-facing gateway for your primary domain name. Any index file (like index.html or index.php) placed directly inside the public_html folder will automatically load when someone types your main website address into their browser.
  • Addon Domain Directories: If you host multiple websites on a single account, cPanel will typically create a new, separate folder inside the home directory (e.g., /yourseconddomain.co.za) specifically for that addon domain's files.

How to Upload Your Website Files

Uploading a single file at a time can be tedious, especially if your website consists of hundreds of images, stylesheets, and scripts. The most efficient method for migrating a site or uploading a new build is to compress your entire website folder into a single ZIP archive on your local computer, upload that one file, and extract it on the server.

Accessing the interface

Step 1: Open the File Manager

Log in to your cPanel dashboard. Locate the "Files" section near the top of the page and click on the File Manager icon. This will open the directory browser in a new tab.

Locating the correct folder

Step 2: Navigate to public_html

In the left-hand sidebar, click on the folder named public_html. Ensure the main panel shows that you are inside this directory before proceeding.

Transferring your data

Step 3: Upload Your ZIP Archive

Click the Upload button located in the top toolbar. A new screen will appear. You can either drag and drop your ZIP file into the dashed box or click "Select File" to browse your computer. Wait until the progress bar reaches 100% and turns green.

Unpacking the website

Step 4: Extract the Files

Click the link to return to the File Manager. Right-click on your newly uploaded ZIP file and select Extract from the context menu. A confirmation box will appear; ensure the extraction path is set to /public_html and click "Extract File(s)".

Housekeeping

Step 5: Move Files and Delete the Archive

Sometimes, ZIP files extract into a subfolder (e.g., public_html/mysite/). If this happens, open that subfolder, click Select All, click Move, and change the file path to simply /public_html/ to bring them to the root. Once your site is live, right-click and delete the original ZIP archive to save storage space.

Editing Code Directly on the Server

Webmasters frequently need to make rapid, minor changes—like updating a spelling mistake on a webpage, verifying a Google Search Console tag, or modifying a WordPress configuration file. Instead of downloading the file, editing it locally, and re-uploading it, you can use the File Manager's built-in code editor.

Important Warning: Always create a backup of a file before editing it directly on a live production server. A single missing semicolon in a PHP file can crash your entire website. You can create a quick backup by right-clicking the file, selecting "Copy", and naming the duplicate filename-backup.php.

To edit a file, locate it within the File Manager (such as your index.html or wp-config.php). Right-click the file and select Edit. A dialogue box may appear asking about character encoding; you can safely leave this on the default setting (utf-8) and click Edit again.

The browser will open a fully featured text editor complete with syntax highlighting for HTML, CSS, JavaScript, and PHP. Make your necessary adjustments, and click the Save Changes button in the top right corner. The modifications will instantly go live on your domain.

Understanding File Permissions

Security is a paramount concern for any online venture. File permissions dictate who is allowed to read, write (modify), or execute the files on your server. If your permissions are too loose, malicious actors could potentially inject harmful code into your website. If they are too strict, your website might not be able to load its own images or scripts, resulting in "403 Forbidden" errors.

In the File Manager, you will see a column labeled "Permissions," displaying a three-digit number. For a standard website to function securely, adhere to these universal rules:

  • Standard Files (HTML, PHP, Images): Should be set to 644. This allows the server to read the file and display it to the public, but only the primary account owner can edit or delete it.
  • Standard Folders (Directories): Should be set to 755. This allows the public to enter the directory to view the files inside, but prevents them from creating new files or deleting existing ones.

If you notice a file with permissions set to 777 (which grants full read, write, and execute access to the entire internet), this is a critical security vulnerability. You can fix it instantly by right-clicking the file, selecting Change Permissions, ticking the correct boxes to reach 644 or 755, and saving the changes.

Viewing Hidden Files (The .htaccess File)

Certain critical server configuration files are hidden by default to prevent accidental deletion. The most common example is the .htaccess file, which controls crucial behaviours like forcing HTTPS redirects, creating custom error pages, and managing permalink structures for WordPress.

If you need to edit this file but cannot see it in your public_html folder, click the Settings button in the top right corner of the File Manager. Tick the box that says Show Hidden Files (dotfiles) and click Save. The .htaccess file will now be visible, and you can edit it just like any other document.

Advanced Server Management

Mastering the File Manager grants you immense control over your digital assets, allowing you to troubleshoot errors, optimise performance, and deploy custom applications with precision. However, managing complex directories and ensuring optimal security protocols can be daunting for growing businesses.

If your enterprise is expanding and you require a more hands-off approach to server administration, consider exploring our managed hosting solutions. With a managed environment, our team handles the technical heavy lifting, file permissions, and core security updates, leaving you free to focus on your business.

As always, PalmHost is committed to empowering your online journey. You can discover more about our robust hosting infrastructure on our about us page. If you encounter any critical errors while modifying files or require a backup restoration, please navigate to our contact us page to open a priority ticket with our support technicians.

Please rate this article to help us improve our Knowledge Base.

0 0