Title: Ghostland Files with Prisoners of the Ghostland and File API
Description:
Inspired by Nicolas Cage’s role in Prisoners of the Ghostland, this project uses the File API to create a web application that allows users to interact with files, reflecting the film’s themes of survival, mystery, and exploration. The application captures the intense and otherworldly atmosphere of the film, enabling users to upload, read, and display file contents dynamically. This project demonstrates the practical use of the File API to enhance user interaction and file management.
Features:
- File Upload: Use the File API to allow users to upload files.
- File Reading: Read and display the contents of uploaded files.
- Thematic Design: Reflect the intense and mysterious atmosphere of Prisoners of the Ghostland through the application’s design and interactions.
Starting Code:
Beginner Hints:
- Create a single
index.htmlfile. - Copy the full HTML code block into that file.
- Open
index.htmlin your browser. If something doesn’t work, try a local server likepython -m http.server. - Open DevTools Console to spot errors and typos quickly.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ghostland Files with Prisoners of the Ghostland and File API</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #1c1c1c;
color: #f0f0f0;
text-align: center;
padding: 50px;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #2e2e2e;
border: 1px solid #444;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
h1 {
margin-bottom: 20px;
color: #ff6347;
}
input[type="file"] {
margin: 20px 0;
padding: 10px;
background-color: #444;
border: 1px solid #555;
border-radius: 5px;
color: #f0f0f0;
}
.file-content {
margin-top: 20px;
text-align: left;
background-color: #444;
padding: 10px;
border-radius: 5px;
border: 1px solid #555;
max-height: 300px;
overflow-y: auto;
}
</style>
</head>
<body>
<div class="container">
<h1>Ghostland Files</h1>
<p>Interact with files inspired by Prisoners of the Ghostland.</p>
<input type="file" id="fileInput">
<div id="fileContent" class="file-content"></div>
</div>
<script>
const fileInput = document.getElementById('fileInput');
const fileContent = document.getElementById('fileContent');
fileInput.addEventListener('change', handleFileSelect);
function handleFileSelect(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
fileContent.textContent = e.target.result;
};
reader.readAsText(file);
} else {
fileContent.textContent = 'No file selected';
}
}
</script>
</body>
</html>
References:
Project Overview:
This project captures the intense and mysterious atmosphere of Prisoners of the Ghostland using the File API to interact with files. Users can upload, read, and display file contents, providing an engaging and interactive experience. The application demonstrates the practical use of the File API for enhancing user interaction and file management, reflecting the film’s themes of survival, mystery, and exploration. Embrace the intensity and intrigue of Nicolas Cage’s character to master the use of the File API in web development. Praise Cage!