Comments (6)
You should be able to upload as many files as you wish.
Could you post an example usage of your code ?
from async-busboy.
@m4nuC the below were my codes,so thanks!
--------------------------------------------------ejs html-------------------------------------------------------
form id="fileupload" action="/upload/" method="POST" enctype="multipart/form-data">
input id="uploadedfile" name="uploadedfile" type="file" />
button id='btn4' type="button">start upload /button>
--------------------------------------------------jquery js--------------------------------------------------------
console.log('uploadedfile====>',1);
$.ajaxFileUpload({
url:'/upload',
secureuri:false,
fileElementId:'uploadedfile',
success: function(data,status){
console.log('data====>',data);
console.log('status====>',status);
if(typeof(data.error) != 'undefstatusined'){
if(data.error){
//print error
alert(data.error);
}else{
//clear
// $('#img img').attr('src',url+'cache/'+data.msg);
}
}
},
error: function(data,status,e){
console.log('data====>',data);
console.log('status====>',status);
console.log('e====>',e);
//print error
alert(e);
}
});
})});
----------------------------------------koa2 js in server----------------------------------
if(ctx.url==='/upload'){
const {files, fields} = await asyncBusboy(ctx.req);
console.log('{files, fields}', {files, fields});
from async-busboy.
The problem comes from your upload script that uses the same name for all files. To debug this, open your browser network inspector (4th tab in Chrome inspector) and look at the upload request payload. Does it mountain 2 files? If not you would have to debug your upload script. (likely the fileElementId
parameter)
This is not an async-busboy issue.
from async-busboy.
@m4nuC Yes,it's my fault, only text file was unable to log file and filed, such as:
I code as the below:
--------------------------------------code-----------------------------------------
const {files, fields} = await asyncBusboy(ctx.req);
console.log('{files, fields}=====>', {files, fields});
---------------------------the infor from console while uploading txt type file------------------------
{files, fields}=====> { files: [], fields: {} }
---------------------------the infor from console while uploading other documentation--------
{files, fields}=====> { files:
[ ReadStream {
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_eventsCount: 1,
_maxListeners: undefined,
path: 'C:\Users\ADMINI~1\AppData\Local\Temp\1463019195662uploadedfile交换中心解决方案.ppt',
fd: 6,
flags: 'r',
mode: 438,
start: undefined,
end: undefined,
autoClose: true,
pos: undefined,
fieldname: 'uploadedfile',
filename: '交换中心解决方案.ppt',
encoding: '7bit',
transferEncoding: '7bit',
mime: 'application/vnd.ms-powerpoint',
mimeType: 'application/vnd.ms-powerpoint' } ],
fields: {} }
Would you please tell me where the cause for? please...
from async-busboy.
This again probably comes from your upload script. Text files should not make any difference. Did you upload them with the same script ?
from async-busboy.
@m4nuC yes, I used the same js file which from internet. I go through every file type, no different was found.
ajaxfileupload.js.txt
from async-busboy.
Related Issues (20)
- Is there a way to expose uploading progress? HOT 3
- How to "drain the request stream" HOT 1
- Throw on('limit') ? HOT 4
- Documentation needs an update HOT 1
- TypeError: request.on is not a function HOT 3
- filePromises not passing to custom onFile HOT 3
- Can't read the file content HOT 1
- how to writestream to desired path in local ? HOT 2
- using asyncBusboy in two middleware HOT 1
- Cleanup function will not remove custom onFile function, memory leak HOT 4
- formData.files as on object
- How can you do onFile with async? HOT 3
- node 14 HOT 18
- Processing unindexed array fields cause a whole process to crash
- Breaks on Node 16 HOT 8
- Replace unsupported busboy version with fastify fork
- Update to busboy 1.3 HOT 1
- Sometime asyncBusboy never responding HOT 2
- 504 Gateway timeout for specific files (.csv / .xlsx) HOT 3
- Publish a new version to npm HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-busboy.