Skip to content
Snippets Groups Projects
Commit 9913e0bb authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Added check on max upload file size

parent 82bda48c
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ADD vospace-ui-frontend/*.js /vospace-ui-frontend/ ...@@ -14,6 +14,7 @@ ADD vospace-ui-frontend/*.js /vospace-ui-frontend/
ADD vospace-ui-frontend/*.json /vospace-ui-frontend/ ADD vospace-ui-frontend/*.json /vospace-ui-frontend/
ADD vospace-ui-frontend/.env.production /vospace-ui-frontend/ ADD vospace-ui-frontend/.env.production /vospace-ui-frontend/
WORKDIR /vospace-ui-frontend WORKDIR /vospace-ui-frontend
ARG VUE_APP_MAX_UPLOAD_SIZE=10
RUN npm run build RUN npm run build
ADD vospace-ui-backend/src /vospace-ui-backend/src/ ADD vospace-ui-backend/src /vospace-ui-backend/src/
......
VUE_APP_API_CLIENT = 'mock' VUE_APP_API_CLIENT = 'mock'
VUE_APP_API_BASE_URL = 'http://localhost:8085/' VUE_APP_API_BASE_URL = 'http://localhost:8085/'
VUE_APP_MAX_UPLOAD_SIZE = 10
VUE_APP_API_CLIENT = 'server' VUE_APP_API_CLIENT = 'server'
VUE_APP_API_BASE_URL = '' VUE_APP_API_BASE_URL = ''
VUE_APP_MAX_UPLOAD_SIZE = 10
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
<div class="mt-3">Selected files: {{ selectedFiles }}</div> <div class="mt-3">Selected files: {{ selectedFiles }}</div>
</b-modal> </b-modal>
</template> </template>
<script> <script>
const maxUploadSize = process.env.VUE_APP_MAX_UPLOAD_SIZE;
export default { export default {
data() { data() {
return { return {
...@@ -56,6 +59,15 @@ export default { ...@@ -56,6 +59,15 @@ export default {
} }
} }
// Check size limit
for (let file of this.files) {
if (file.size >= maxUploadSize * Math.pow(10, 9)) {
this.uploadFileError = "File " + file.name + " is too big. Max allowed file size is " + maxUploadSize + " GB";
return;
}
}
// Upload
this.$store.dispatch('uploadFiles', this.files) this.$store.dispatch('uploadFiles', this.files)
.then(() => { .then(() => {
this.$bvModal.hide('upload-files-modal'); this.$bvModal.hide('upload-files-modal');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment