Skip to content

File Publishing

Abstract

In this activity, you will learn how to upload files to the CS student web server. You will also gain experience with the Nu HTML Checker.

The CS department has a webserver named w3stu that students can use to host websites and client-side applications. w3stu is the same machine as stu, the server you may have used in other courses. To connect to the server to transfer files, use stu.cs.jmu.edu. To access your files via a web browser, use w3stu.cs.jmu.edu.

Installing FileZilla

For today’s activity, we will use FileZilla, an open-source graphical file transfer app. Follow these instructions to install FileZilla on your laptop. (FileZilla is already installed on CS lab machines.)

Installation Instructions

  1. IMPORTANT – Do NOT download FileZilla via the green button on their website. If you do, you will get the “sponsored” installer which contains adware.
  2. Go directly to this page to get the adware-free version for your OS:
    https://filezilla-project.org/download.php?show_all=1

Alternatively, you can install via package manager:

  • Linux: sudo apt install filezilla
  • macOS: brew install --cask filezilla

Connect to w3stu

Once you have FileZilla installed, connect to stu.cs.jmu.edu using the sftp:// protocol as shown in the screenshot, setting your username and password as appropriate. The first time you connect to stu, you will get the “Unknown host key” pop-up box as shown; click “OK” to continue.

Logging in for the first time

Make sure that the Host: is sftp://stu.cs.jmu.edu and not just stu.cs.jmu.edu. The default behavior for FileZilla is to use the insecure ftp:// instead of sftp://. This will not work, as stu does not accept incoming ftp:// connections.

Once connected, the right side will show the path /cs/home/stu/username (where username is your JMU eID). Under the “Filename” list, scroll down until you see the “www” folder shortcut.

Remote site showing path

Double-click the “www” shortcut and you will see something like the screenshot below. Notice that the “Remote site:” has changed to /cs/www/stu/username, which is the base directory of your website on the server’s file system.

Remote site showing path

Tip

If you don’t have a www shortcut, you can create one by running the following command on the stu server. (You will need to ssh to stu in order to run this command.)

ln -s /cs/www/stu/$(whoami) www

Publish index.html

Any file that you drag-and-drop into your www directory will be published on w3stu automatically. If you copy a file named foo.html into this directory, you can access that file by pointing a web browser to the URL https://w3stu.cs.jmu.edu/username/foo.html. Within FileZilla, you can also create subdirectories to organize your site’s pages.

Right-click the link below to save a copy of the file on your computer. Then rename the file to index.html.

Open the index.html file in a text editor and change your name in the <meta> tag that indicates the author. Then upload the index.html file to the stu server so that it can be accessed via the link https://w3stu.cs.jmu.edu/username/cs343/ (with your username). Note that you will need to create the cs343 directory under your www directory.

Test this step by going to the URL in your web browser. None of the links should work, because you haven’t yet uploaded those files.

Publish other files

Right-click each link below to save a copy of the files on your computer.

Upload the data.txt file so that it is in the same directory as the index.html file. Click on the “text file” link from the index file, and confirm that you can access it.

Upload the linked.html file, but you’ll need to create a subdirectory and rename the file in the process. Once you’ve uploaded the file, it should be in your www/cs343/linked subdirectory and renamed as index.html.

When you are finished, you should have the following files and directory structure, and all links in the index file should work:

https://w3stu.cs.jmu.edu/username/cs343/
https://w3stu.cs.jmu.edu/username/cs343/index.html
https://w3stu.cs.jmu.edu/username/cs343/data.txt

https://w3stu.cs.jmu.edu/username/cs343/linked/
https://w3stu.cs.jmu.edu/username/cs343/linked/index.html

Validation and style

Your project must successfully pass the Nu HTML Checker. The provided index.html file intentionally does not pass. Copy the link to your index.html file into Nu, and fix the errors based on the feedback. Do the same for the linked/index.html file.