Skip to content

avzlobin79/upload-image-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

upload-image-sevice

https://upload-image-service.herokuapp.com/

HTML page(/index.html)

There are three ways to upload a file to the server.

  • POST multipart/form-data
  • POST json/application (payload encoded in Base64)
  • Upload file through URLS, which are separated by commas.

We can get also preview for uploaded files. CheckBox "isPreview" allows to do it. Each file after uploading to the server, we can download the link. It is also possible to stop the service. NOTICE:Shutdown service is disabled on Heroku!

API

Endpoints

RESPONSE
It is the same for all paths.
[{"fileName":"test.txt","fileDownloadUri":"http:https://localhost:8080/downloadFile/test.txt","filePreviewDownloadUri":null,"fileType":"txt","size":4}]
REQUEST
POST /upload/formdata/{isPreview}
POST /upload/json/{isPreview} 
REQUEST Payload is JSON :[{"originalFileName":"test.txt","contentType":"text/plain","size":4,"payLoad":"dGVzdA=="}
POST /upload/urls/{isPreview}
Payload is String : https://bipbap.ru/wp-content/uploads/2017/04/11-1.jpg,https://bipbap.ru/wp-content/uploads/2017/04/11-2.jpg 
isPreview is Boolean (creating preview file) 
POST /actuator/shutdown
Stop service.

Setup

file: main\resources\application.properties
## MULTIPART (MultipartProperties)
# Enable multipart uploads
spring.servlet.multipart.enabled=true
# Threshold after which files are written to disk.
spring.servlet.multipart.file-size-threshold=2KB
# Max file size.
spring.servlet.multipart.max-file-size=200MB
# Max Request Size
spring.servlet.multipart.max-request-size=215MB
## File Storage Properties
# All files uploaded through the REST API will be stored in this directory
file.upload-dir=./uploaded-image
# All preview files uploaded will be stored in this directory
file.upload-dir-preview=./uploaded-image-preview
# Size preview file
file.width-preview=100
file.height-preview=100
## Shotdown (actuator)
# No auth  protected 
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
file: main\resources\test-application.properties
For the test, you must specify the port.
## DEFINE port for integration test
server.port = 8090

Run application

/opt/jdk1.8.0_171/bin/java -jar -Dserver.port=8080 upload-image-service-0.0.1-SNAPSHOT.jar

About

REST service for uploading and loading image.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published