Single and Multiple Files Upload Example in Django REST API

Most of the applications require at least one file needs to be upload for a reason, such as, for uploading bulk data or processing file data for business requirement. This example will show you how to upload single or multiple files using Django REST framework. REST is an acronym that stands for Representation State Transfer which works on http/https protocol. It is light weight and delivers data very fast. I am assuming you have a basic knowledge on Python and Django REST framework before you proceed further down. I am…

Continue

Single or Multiple Files Upload Example in Django Framework

In your application or project there is always a requirement for uploading a file data. This file data could be in a specific format depending on your requirement. Here I am going to explain you how you can upload single or multiple files in your python based Django framework. I am assuming you have a basic knowledge on Python and Django framework before you proceed further. I am also going to show you how to implement CSRF token for uploading files.

Continue

Junit Testing for Multiple Files Upload Spring REST Controller

Introduction Here I am going to write Junit test case for testing multiple files upload in Spring REST Controller. I have already created how to upload multiple files using Spring REST API and I also had shown how to test it through REST client tool – Postman. In this tutorial I am going to use Junit 5, @WebMvcTest annotation to test the multiple files upload REST API. @WebMvcTest annotation can be used not only to test Spring Controllers but also Spring REST Controllers. I will build the applications using both maven…

Continue

How to upload multiple files using Spring REST API

Introduction Here in this tutorial I am going to tell you how to upload multiple files using Spring Boot REST API. I had also shown you in my another example how to upload single file using Spring Boot REST API framework. For uploading file(s) you can use any client, for example, browser or any REST client (Postman) that supports for uploading of files. Even you can write client side code using HTML, CSS jQuery/JavaScript or React JS, Angular etc. to upload multiple files.

Continue

File Upload and File Download REST APIs Testing using Rest Assured in Java

Introduction In this tutorial we will test REST APIs used for file upload and file download. The file upload or download application might have been created using any server side technology. We are going to use here Rest Assured library with Junit 5 framework in Java programming language. We will use multipart for file upload test. For download test you don’t need such content type – multipart. The fluent API used by REST Assured supports the familiar Given/When/Then syntax from behavior driven development (BDD) framework, resulting in a test that is easy…

Continue

How to read, write and compress text file in Python

In this tutorial we will create examples how to read text file and gzip file. We will also create a text file and compress or gzip file. The gzip file or compressed file extension is gz. Prerequisites Python 3.8.1 Import Module Import required module as a first step in the Python script. Read File The below function read either compressed or gzip (gz) text file or uncompressed text file depending upon the value True or False of the parameter compress. You can pass the file name with full path from…

Continue

Spring Integration – Manipulate RSS Feed Data and Write to Files

Introduction In this tutorial we will create an example on how to manipulate data from RSS Feed and write to files periodically using Spring Integration framework. This guide uses Spring Integration using Java configuration to retrieve data from RSS feed, manipulate and write to files. In this example we will create both gradle and maven based build configurations to build our application. We will read the feed data from URL https://spring.io/blog.atom. We will transform to return the feed title, author and URL in a single line and write to the…

Continue

How to download file using Python Flask

Introduction Here I am going to show a simple example on how to download a file using Python Flask. We will download the file which is kept in the server location. The file could be any type of file, i.e., pdf, text, excel, word etc. In this example there will be a simple UI (user Interface), where a link will be provided to the user and clicking on the link a file will be download. The downloaded file will ask you to choose a location for saving it. There could…

Continue

AJAX File(s) Upload using Python Flask and jQuery

Introduction We will create an example here and we will show you how to upload single file or multiple files using AJAX and jQuery along with Python Flask technologies. You can either upload single file using browse button or multiple files using browse button by holding CTRL key(in Windows OS) from keyboard while selecting multiple files. The file or files is/are uploaded into a folder called uploads. Make sure this uploads folder exists in the system.

Continue