I am in the process of creating an intranet customer management system that will be run on a standalone computer. The software will allow the staff at the shop to upload files to each customer's record. When a customer's record is accessed, all the content ...
Is there a way to download a file from my server to my machine by accessing a page on a nodeJS server? I am currently using ExpressJS and I have attempted the following: app.get('/download', function(req, res){ var file = fs.readFileSync(__dirname + ' ...
I am currently utilizing JsPDF to export HTML content into a downloadable PDF. Explore the following example which involves taking some HTML content and generating a downloaded PDF file using JsPdf import React from "react"; import { render } fro ...
Suppose there is a directory with the following list of files: Something_2015020820.txt something_5294032944.txt.a something_2015324234.txt Something_2014435353.txt.a The goal is to retrieve a list of files sorted by the oldest date (not filename) and on ...
...and by .ext, I'm referring to maintaining the original file extension! This question has been raised in the past, but unfortunately, the solution provided doesn't seem to work at all. At least not for me. Here is how I began: $directory = $_SERVER['D ...
My background is in C++, and I typically create data handling classes/functions to work with stream objects instead of files. I'm curious about how I could revise the following code to handle a stream of binary data in memory rather than a file handle. de ...
What is the best way to display only file names from a specific directory without including any sub-directory files? ...
Within my express route, I have the following code snippet: let response = await fetch("http://someurl"); response = await response.blob(); console.log(response) const imgURL = URL.createObjectURL(response); However, I am encountering an error a ...
When working on my project using nest.js in MacOS Sonoma, I encountered a problem where the image folder src/products/images gets deleted after every project rerun (npm start). The images are saved like this: for (const image of images) { const fileName ...
I am currently working on developing a local app for personal use, and I want to store all data locally in JSON format. I have created a Posts Interface and an array with the following data structure: this.p = [{ posts:{ id: 'hey man', ...
After importing my txt file as a string using the `open` method: with open('./doc', 'r') as f: data = f.readlines() I then attempted to clean the data by iterating through it with a for loop: documents = [] for line in data: ...
I currently have a small form with two buttons - one for browsing and another for uploading an image. I feel that having two separate buttons for this purpose is unnecessary. Is there a way to combine the browse and upload functions into just one button? ...
Hey there, I'm trying to figure out how to download CSV files from a folder located on the root directory of one server to another server using FTP connection. I've included the code below, but unfortunately it's not working for me. The FTP connection is ...
I've created a script using Selenium IDE for Firefox on Windows 7 with FF 25.01 IDE version 2.4.0. The script is functioning well, but I'm interested in saving a particular page element from the query it executes to a text file. The page being l ...
Encountering errors when customers attempt to upload a jpg image on my PrestaShop front office product page: Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in /var/www/peciatky/eshop/images.inc.php on line 255 Warning: im ...
Is there a way to delete only the json files within a directory (multiple levels) without specifying each file name individually? I thought fs-unlinkSync(path) might work, but I haven't found that solution yet. I attempted to use the following method: fs. ...
Is there a method to upload files larger than 50 mb on the express server? I keep encountering the file size limitation of 50 mb. Appreciate any help. Thank you. ...
I'm currently working on a program that opens a file and displays its contents. I'm running into issues with defining it, I think? Either I get an error saying "path" is not defined or "new_dir" is not defined. Below is the code: import pathlib def prog_ ...
I have a task where I need to fetch a list of filenames from a folder and then insert them into a mysql database using php. However, when I try inserting the filenames into the database, it seems to be stuck in an infinite loop. Even though there are only ...
I have the following content in a text file: 1 /run/media/dsankhla/Entertainment/English songs/Apologise (Feat. One Republic).mp3 3 /run/media/dsankhla/Entertainment/English songs/Bad Meets Evil.mp3 5 /run/media/dsankhla/Entertainment/English songs/Love M ...
Here is an example from a log file: {"timestamp": "2022-01-14T00:12:21.000", "Field1": 10, "Field_Doc": {"f1": 0}} {"timestamp": "2022-01-18T00:15:51.000", "Field_Doc": {"f ...
I have written some code below and I am currently testing it, so there are no database queries in the code yet. In the code below, where it checks if(filesize($filename) != 0), it always goes to the else block even though the file is not empty and has 16 ...
I'm trying to attach a file to an event like this: event.target.files[0]=newFile; The error I'm getting is "Failed to set an indexed property on 'FileList': Index property setter is not supported." Is there an alternative solution for this issue? ...
Is there a way to convert a Blob into a File object in ElectronJS? I attempted the following: return new File([blob], fileName, {lastModified: new Date().getTime(), type: blob.type}); However, it appears that ElectronJs handles the File object differently ...
Just starting out with JavaScript and working on a simple project. My goal is to have the background image of an HTML document change to a random picture from a directory named 'Background' every time the page is opened. function main() { // ...
I am working on a project that involves uploading images through a form. I am unsure of the exact number of pictures that will need to be uploaded at one time. Is there a solution using jQuery/AJAX to add file upload fields dynamically to the form? ...
def novice(): dataFile = "studentgrades.csv" fileData = open(dataFile, "r") userScores = [] if "novice" in row print (row) fileData.close() I have attempted to write this function but I'm unsure ...
I have successfully completed a task given by my teacher to generate attributes for a user based on their name. I used Json to write the data to a file and managed to do it with just 'math' and 'random', as per the requirements. However ...
Let's say I have multiple CSS files (a.css, b.css, ..., e.css) and after concatenating and compressing them, I get a new file called compressed.css. Now, I need to verify if each of the original CSS files is included in the compressed.css file. Are th ...
Upon receiving a file from aws s3, it appears in the following format: b'x1fx8bx08x00x0e@xfd[x00x03x03x00x00x00x00x00x00x00x00' What exactly does this represent? In addition, when extracting data, unzipping, and uploading it back to aws ...
Previously, my Node.js code seamlessly integrated with any javascript+HTML project I worked on, leading me to believe there was a direct correlation between Node.js and vanilla Javascript+HTML. However, this misconception was shattered when attempting to u ...
Here is a code snippet I'm looking for: fs.writeFile(fullFileAddress , data, function (err) { if(err) { if(err.code == 'ENOENT') { console.error( new Error(`#Space. Can not save file. message: ${err}`.red ...
I am currently attempting to include the Content-Length header in my file response in order to display a progress bar on the client side. I am using this method: return response()->header('Content-Length', $fileSize)->file($this->filesPa ...
Looking for some assistance with a PHP issue I am having. I know my way around PHP, but I wouldn't say I'm an expert. Here's the problem: I have created an HTML form (form.html) and now I want the output from formular.php to be saved as a unique HTML file ...
Is it feasible to display the contents of a text file uploaded via a form directly from the $_FILES variable without saving it on the server first? I am aware of the security implications, but this will only be executed on a local machine. ...
Is it possible to include an image file in the dataString for a single function? Here is what I have: $.ajax({ type: "POST", url: "../insert.php", data: dataString, success: function(response){ console.log( ...
I am working with the crypto module in node.js and have successfully generated a public/private key pair. However, I am facing an issue when trying to save it to a file and then load it back into memory from that file. Here is what I have so far: https:// ...
Encountering an issue with my NodeJs application where I'm using log4js for logging. The error in the console window is related to a syntax problem while running in the express runtime platform. Error: undefined:1 ?{ ^ SyntaxError: Unexpected token ? in ...
I have a script that takes two inputs: a file with a list of names, another file, which may be empty or not The script's objective is to retrieve information on each name from the first file by accessing a specific API, and then write this information t ...
I want to discuss the topic of file security with you. Currently, I have a PHP script that retrieves a file from an <input type="file"> tag and then uses file_get_contents() to store the file data in a variable. However, I am concerned about potenti ...
Having trouble uploading multiple PGP files to a website using Python and Selenium. The script seems to only recognize the first file and not the rest. Any suggestions on how to fix this issue? I've checked my code, which includes the use of Selenium ...
Is there a way to extract data like this? data:application/pdf;base64,JVBERi0xLjQKJeHp69MKMSAwIG9iago8PC9UeXBlIC9DYXR…AKdHJhaWxlcgo8PC9TaXplIDE4Ci9Sb290IDEgMCBSPj4Kc3RhcnR4cmVmCjg4MzEzCiUlRU9G from an input file? $('#file').change(functio ...
Currently, I have a significant amount of files stored within a specific directory, and to locate particular files using PHP's glob function. Below is the code snippet that I am currently using: /* SAMPLE FILE NAME: PR330037JED10220161204.csv */ $dir ...
I am working with a folder structure that contains multiple directories and files. My goal is to create a file in each directory to keep track of which files have been read. This created file will then be used as a condition to decide whether to skip or re ...
I'm looking to retrieve and modify the details of a .mp4 file, specifically the Description property (Title, Subtitle, Rating, Tags, Comments). Is there a way to do this using Node.js? I understand that typically you would right-mouse click on the file, ...
I recently installed AutoKey on my computer with the intention of being able to run python scripts using keyboard shortcuts. Specifically, I wanted to create a script that would simulate pressing the "d" key followed by the "s" key in a loop, with the abil ...
I am currently working on developing a REST API that involves handling JSON files. One particular aspect of the project requires me to open a JSON file, check for specific content existence, and add it if necessary. To achieve this, I need to load the JSON ...
I am currently working on developing a compact file upload component. Previously, I utilized the <input type="file"> tag but due to limited space constraints, I need to display both "Choose file" and the complete file path within a very sma ...
Currently, I am facing an issue while trying to move a file from another directory to the current directory. Moving a file from the current directory to another works fine for me. However, when attempting to move a file in the opposite direction, I encount ...
Is there a method to automatically remove the last character from each line in a file using PHP? I am working with a file containing multiple lines, and I need to delete the final character of each line. Do I have to iterate through the file line by line ...
My query pertains to the handling of imports in web pages. When a file is imported into another, do the declarations and imports from the imported file become available in the file where it is being imported? A suggestion was made for me to import a compo ...
I'm currently trying to utilize a custom function that I found on the PHP manual website (shared by a user). This function is designed to generate a nested array containing all files and folders within a specified directory on your server. Since I am ...
I'm currently working on an angular application and writing test cases using selenium. I encountered a scenario within one of my test suites where I need to trigger the opening of a Windows FileInput dialog by clicking a button, then selecting a file tha ...
I kindly request a review of my code prior to making any changes. const test = () => { const [files, setFiles] = useState ([]); //I believe I need to modify the following statement. const handleFile = (e) => { const newFiles = [] for (let i= ...
Below you will find the code snippet: define(ADMIN_ROOT,'/var/www/abc/pqr/web/control/'); $filename = $test_data['test_name']; $flname = ADMIN_ROOT.'modules/tests/test_pdfs/'.$filename; header("Content-Type: application/pdf") ...
Is there a way in JavaScript to write content to a JSON or TXT file and then download it, similar to how it is done in Python? const content = "Hello"; const link = document.createElement('a'); link.setAttribute('download', 'FileToWriteIn.txt'); link.href ...
As I was working on my DiscordJS Bot project, I encountered an issue regarding returning a png file saved in my local folder using FS. The bot is able to navigate through folders smoothly, but the challenge lies in returning the actual file rather than j ...
As I work on a Python project, I encountered a situation where I need to open a file and display a message if the file does not exist. However, I am unsure whether it is necessary to close the file when an exception occurs. try: file = open(s ...
Currently, my front end is built using Angular 4 and the back end is developed with Lumen 5.4. The task at hand requires me to export certain data as both an Excel and a zip file. I am utilizing the { saveAs } import from the package 'file-saver/Fil ...
As I work on creating an application, I am trying to develop a function that can read sound and music states before the application starts. The challenge lies in the fact that there will be no recorded data the first time it runs. In my initial attempt, I ...
Currently, I am encountering an issue while attempting to upload a file submitted in a form using PHP. To avoid page reloading, I have incorporated JS, jQuery, and AJAX between HTML and PHP. Unfortunately, I am facing difficulties with the $_FILES variable ...
I am trying to open multiple images simultaneously in the default Windows Photo Viewer that I have stored in my folder using the npm open library: let files = ['Dog.gif', 'Cat.jpeg']; for(let i=0; i<files.length; i++){ open(`${files[i]}`, {wait:true}) ...
I find myself having to repeatedly pass the file encoding. Is there a way to establish a default file encoding? var f=fs.readFileSync('foo.txt','utf8'); >> var f=fs.readFileSync('foo.txt'); When the encoding option ...
Struggling with reading text files line by line? While console.log(file) may work, it doesn't allow for processing each individual line. Here's my approach: In api.service.ts, I've implemented a function to fetch the file from the server: ...
My desktop has an html file which requires input. How can I save this input to a file on my computer? Do I need to use a different language like python or javascript, and if so, how do I do it? Additionally, is there a way for javascript to launch an app ...
I am developing a function that can convert a list of paths into an object structure as illustrated below; this script will generate the desired output. Expected Output data = [ { "type": "folder", "name": "dir1& ...
I am attempting to convert a base64 string into an image file and send it to Firebase through Express. Everything is functioning correctly on the frontend, except for this particular section: const convertBase64ToFile = (base64String, fileName) => { ...
I've created a component to download a PDF file. The PDF file is named resumeroshan.pdf and it's located inside the Assets folder. "use client"; import resume from "/../../Assets/resumeroshan.pdf"; export default function Abo ...
Upon executing the following code: var list = new Uint32Array(16); for (var i=0; i<16; ++i) list[i] = i; fs.writeFileSync("list", new Uint8Array(list).buffer); console.log([].slice.call(new Uint32Array(fs.readFileSync("list")))); We anticipate the out ...
Currently, I am using the following Python code: file = open(filePath, "r") lines=file.readlines() file.close() If my file contains multiple lines (10,000 or more), my program tends to slow down when processing more than one file. Is there a way to optim ...
If I have a folder structured as follows: ABC |_ a1.txt |_ a2.txt |_ a3.txt |_ a4.txt |_ a5.txt What is the best method in PHP to extract only the file names with a specific extension, while disregarding any directories? ...
I am encountering a significant issue with the struct.unpack function in Python. I have a binary file that follows a specific format, which can be written either in MATLAB or Python. When I write data to a binary file in Python and read it back, everythin ...
Looking for a solution to create a non-flash upload panel with a progress bar? Our server is on PHP 5.3 and we cannot upgrade to 5.4 or use flash based solutions. I've been experimenting with XMLHttpRequest and AJAX, but have only had partial success ...
Confusion Alert: The title might not make sense, but I'm stumped on how to put it into words. I've set up an app.route in Flask for handling some assets. @app.route('/assets/css/<path:path>') def send_css(css_file): return send ...
Recently, I developed a basic PHP script that fetches data from a local JSON file and uses it to respond to various queries directed at the page. In my implementation, I adopted the usage of file_get_contents() for reading the file. However, as the number ...