skip to Main Content

Php versions – PHP echo() corrupting readfile() output

I have this PHP script (process.php): <?php // Include necessary libraries for database, PDF generation, and ZIP compression. require_once('db_connection.php'); require_once('tcpdf/tcpdf.php'); if (isset($_POST['submit'])) { // Get uploaded file data $csvFile = $_FILES['csv_file']['tmp_name']; // Initialize progress variables $totalRecords = count(file($csvFile)) - 1;…


How could I read from an empty json File,at the start of the program is it empty but later can be written

The read file is that: public ArrayList<Aventura> readFile(){ ArrayList<Aventura> aventures = new ArrayList<>(); try{ AventuraDAO aventuraDAO=new AventuraDAO(); AventuraManage aventuraManage=new AventuraManage(aventuraDAO); Gson g=new Gson(); JsonReader reader=new JsonReader(new FileReader("Files/adventures.json")); Aventura[] ave=g.fromJson(reader, Aventura[].class ); if (ave.length==0){ System.out.println("The file should be empty"); ArrayList<Aventura> aventures2…

Back To Top