How-to articles, tricks, and solutions about FILE

Apache Files Expires / Apache Set Caches

Apache is free and open-source cross-platform web server software. Read and know about Apache Files Expires module and how to set caches with Apache.

byte[] to file in Java

To write a byte[] to a file in Java, you can use the following code:

Copying files from one directory to another in Java

To copy a file from one directory to another in Java, you can use the Files.copy method from the java.nio.file package.

Downloading a file from spring controllers

To download a file from a Spring controller, you can use the ResponseEntity class along with the InputStreamResource class.

file upload php $_FILES undefined index error

The error "Undefined index: (name of the file input)" in PHP usually occurs when the form that is used to upload the file is not properly configured.

Getting the filenames of all files in a folder

To get the filenames of all files in a folder in Java, you can use the File class and its list method.

Getting the names of all files in a directory with PHP

In PHP, you can use the scandir() function to get the names of all files in a directory.

How can I view/open a word document in my browser using with PHP or HTML

You can use the PHP function readfile() to read the contents of a Word document and then use the appropriate headers to prompt the browser to open or download the file.

How do I add PHP code/file to HTML(.html) files?

To add PHP code to an HTML file, you will need to use PHP tags.

How do I append to a file?

To append to a file in Python, you can use the "a" mode of the built-in open() function.

How do I call a function from another .py file?

You can call a function from another .py file by importing the file and then calling the function.

How do I check file size in Python?

To check the size of a file in Python, you can use the os module to get the size of the file in bytes.

How do I create a Java string from the contents of a file?

To create a Java string from the contents of a file, you can use the following code:

How do I get file creation and modification date/times?

There are a few ways to get the file creation and modification date/times, depending on the programming language and operating system you are using.

How do I get the file extension of a file in Java?

To get the file extension of a file in Java, you can use the File class and its getName() method to get the file name, and then use the substring() method of the String class to extract the extension from the file name.

How do I get the file name from a String containing the Absolute file path?

To get the file name from a String containing the absolute file path in Java, you can use the following methods:

How do I load a file from resource folder?

To load a file from the resource folder in a Java application, you can use the ClassLoader and getResourceAsStream method.

How do I remove/delete a folder that is not empty?

You can use the shutil module in Python to remove a folder that is not empty.

How do I save a String to a text file using Java?

To save a String to a text file in Java, you can use the write method of the FileWriter class. Here's an example of how you can do this:

How to Clean Your Ubuntu Machine

4 ways to clean your ubuntu machine. Here are some ways to clean your ubuntu PC and make it faster. Try the examples yourself and see the results.

How to Configure Git to Ignore File Mode Changes

Sometimes, working on local development there is a need to change permissions on various files. The tutorial will show how to ignore the File Mode changes.

How to Convert the Image into a Base64 String Using JavaScript

Read this tutorial and learn several methods of converting an image to a Base64 string using JavaScript. Choose the right approach for you and try examples.

How to Copy a File from/to a Remote Server

SCP is being used to copy files from one machine to an other one. It can be used to transfer (download and upload) files vis ssh.

How to copy files

To copy a file in Python, you can use the built-in "shutil" module.

1 2 3