I am using krajee file input to upload images. It works well for small images. But it fails to upload large images. When I checked requests in server side the small images has mimeType=image/jpeg and large images has mimeType=application/octet-stream with size=0 Here are my file uploader configurations.
$("#file-4").fileinput({
theme: 'fa',
uploadUrl: uploadUrl,
allowedFileExtensions: ['jpg', 'png', 'gif', 'jpeg'],
overwriteInitial: false,
maxFileSize: 12500,
maxFilesNum: 4,
showCaption:false,
rtl: true,
showRemove: false,
showUpload: false,
showCancel: true,
browseOnZoneClick: true,
initialPreview: imageData,
initialPreviewConfig: JSON.parse(unescape(configData)),
deleteUrl: 'http://localhost:8000/ajax/upload/image/delete?fileName=' + $('#fileName').val(),
deleteExtraData: {file: this.key},
initialPreviewThumbTags: tags,
browseLabel: 'Upload Images',
layoutTemplates: {
footer: footerTemplate,
actions: actionsTemp
},
uploadExtraData: {
folder: $('#folder').val()
}
});
Likely the issue is with server side settings, for example in php.ini.
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
Both should be set above the max size you wish to upload.
The issue is not in the server settings. My server has upload_max_filesize and post_max_size=150M.
The problem with large file (>2MB) is the Resumable option of plugins .
You have to disable uploadAsync and set this option:
enableResumableUpload: false,
Related
I'm having trouble forcing highcharts to export offline. I've added the offline-exporting.js module along with the exporting module. I've set the fallbackToExportServer to false, but I still go to the highcharts server (https://export.highcharts.com/) and get this error: 13 Request Entity Too Large.
<script src="//code.highcharts.com/highcharts.js"></script>
<script src="//code.highcharts.com/modules/data.js"></script>
<script src="//code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/offline-exporting.js"></script>
exporting: {
filename: title,
fallbackToExportServer: false,
To see the issue, go to: https://www.nrel.gov/transportation/drive-cycle-tool/
In the Drive cycles table, search for “Fleet DNA”.
Click on “Fleet DNA Drayage Maximum Energy*”
Scroll up and click “Download Drive Cycle Data or Image” under the chart.
Choose “Download JPEG image”
Some data sets work fine.
It is linked to this reported issue:
https://github.com/highcharts/highcharts/issues/4614
As a workaround you could set up a custom exporting server with increased size limit:
https://www.highcharts.com/docs/export-module/setting-up-the-server
I noticed the same issue few days back, kind of strange, despite setting the flag to false, it was calling the highchart server for chart pdf.
I then resorted to use exportChartLocal method of highchart chart instance:
chart.exportChartLocal({
type: 'image/jpeg', // replace with image/jpeg
filename: 'test.jpg',
fallbackToExportServer: false,
sourceWidth: 900,
scale: 1,
});
Look at this example: https://jsfiddle.net/riteshwaghela/huw8e31z/7/
I wonder if Serilog can be configured to create a circular logging file when a certain file size limit is reached it deletes older records.
I've already tried to configure it with the out of the box (File) writer
"Name": "File",
"Args": {
"path": "c:\\temp\\MyFile.txt",
"fileSizeLimitBytes": 200,
"rollOnFileSizeLimit": true,
"retainedFileCountLimit": 1
}
And I've explored the sink "Serilog.Sinks.RollingFileAlternate" already.
But all these packages give me a rolling file based upon size but are creating each time new log files.
In my angular 5 application, I use xlsx to read content (contact information of teacher like email and name) from microsoft excel file, after webpack the application for production, I found the size of xlsx module is as large as 1.1M compared to all #angular module size as 1.6M, is there some method to reduce the size considering only use parsing function?
===========================
updated:
"dependencies": {
...
"xlsx": "^0.12.10",
...
},
in ts file:
import * as XLSX from 'xlsx';
then use XLSX.WorkBook and WorkSheet and XLSX.utils.sheet_to_json, etc.
I tried https://github.com/SheetJS/sheetjs/issues/694#issuecomment-468745153
const xlsx = await import('xlsx');
It only loads the xlsx.js when you use need xlsx. It will not reduce the bundle size but splits the code which will be loaded only when you use it.
I would like to ask a question about CommonsChunkPlugin
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
vendor: ['moment'],
app: ['./www/build/main.js']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js'
},
module: {
rules: [
{ test: /\.(js)$/, use: 'babel-loader' }
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'chunk'
})
]
}
After i run the webpack script, there are 3 files generated (vendor.bundle, app.bundle, chunk.bundle). My questions are:
What is the usage chunk.bundle and why it is generated? I set the config in "entry" and output is depends on the [name] of entry
How can i run the script to all files under a folder? The current setting needs to input one by one.
If my file is too large, how can i split is into some smaller files?
Thanks.
1) The chunk.bundle.js is being generated by the plugin. It operates a little outside of the usual Webpack flow.
2) Not sure what you're getting at, here. You probably need to look at the minChunks setting, or chunks.
3) You can use multiple instances of the plugin. I've found that you have to use the chunks setting on every instance except for one to avoid getting an error. Basically that specifies on what entry files the plugin will operate. You can specify all your entry files in chunks, and then use a function with minChunks to filter out what you want to include in that file.
I'm dumping the old question content since it's overly complicated.
It's simple now.
How to change the multipartResolver from the standard:
org.springframework.web.multipart.support.StandardServletMultipartResolver
to
org.springframework.web.multipart.commons.CommonsMultipartResolver
?
I'm failing to do so with Grails v3.2.6.
I've tried various things mentioned here (declaring the beans, filters, disabling MultipartAutoConfiguration):
Required MultipartFile parameter 'file' is not present
How to use CommonsMultipartResolver in Spring Boot
Not sure about changing the implementation but I did have to change the respective config settings in application.yml to someting like...
grails:
controllers:
upload:
maxRequestSize: 10000
maxFileSize: 10000
multipart:
maxRequestSize: 5MB
maxFileSize: 5MB