Comments (4)
I tried this code:
- express 4.17.1:
const options = new DiskStorage({
directory: 'upload'
});
app.use('/upload/files', uploadx.upload(options), (req, res) => {
res.sendStatus(500);
});
- modified app/service-code-way/service-code-way.component.ts, angular 11.2.7 ,
build --prod
:
@Component({
selector: 'app-service-way',
templateUrl: './service-code-way.component.html'
})
export class ServiceCodeWayComponent implements OnDestroy, OnInit {
state$!: Observable<UploadState>;
uploads: Ufile[] = [];
numberOfCopies = 0;
@ViewChild('file', { read: ElementRef })
fileInput!: ElementRef;
private unsubscribe$ = new Subject();
constructor(private uploadService: UploadxService) {}
onChange(): void {
const files = this.fileInput.nativeElement.files;
for (let i = 0; i < files.length; i++) {
this.uploadService.handleFiles(files[i], {
endpoint: `${environment.api}/upload/files`,
multiple: false,
token: 'token'
});
}
}
ngOnInit(): void {
this.state$ = this.uploadService.init();
this.state$.pipe(takeUntil(this.unsubscribe$)).subscribe(state => {
const file = this.uploads.find(item => item.uploadId === state.uploadId);
file ? file.update(state) : this.uploads.push(new Ufile(state));
});
}
...
Couldn't catch the error.
8 retry attempts or 5 retries if i set retryConfig: { maxAttempts: 5 }
sendFileContent() and getOffset() should always reject at code 500.
Only In uploader-examples\multipart-form-data.ts
a similar error is possible.
from ngx-uploadx.
Sorry, I wasn't clear enough. The issue appears when a 500 is returned when the file upload is completed.
from ngx-uploadx.
Is it possible to test with this server code (with correct PATH and PORT)?
const express = require('express');
const { uploadx } = require('node-uploadx');
//
const PATH = '/api/v1/videos/upload';
const PORT = 3003;
//
const app = express();
let retries = 0;
app.use(PATH, uploadx.upload({ directory: 'upload' }), (req, res) => {
return res.status(500).json({ message: `is something wrong, ${retries++}` });
});
app.listen(PORT, () => console.log('listening on port:', PORT));
P.S.
endpoint: `${environment.apiUrl}/api/v1/videos/upload?uploadType=multipart`,
uploadType
should not be used, it is only for the demo application.
from ngx-uploadx.
I cannot reproduce either, but it would be convenient to have a shouldRetry
function in https://github.com/kukhariev/ngx-uploadx/blob/master/src/uploadx/lib/retry-handler.ts#L53 because in our use case an error 500 is considered as fatal.
from ngx-uploadx.
Related Issues (20)
- Uploading of same file simultaneously in two different tabs of same window is failing HOT 3
- Window is not defind with Server Side Rendering HOT 1
- Location Error HOT 5
- Feature request: maxChunkSize HOT 2
- Chunk timeout HOT 4
- Big files upload error with iOS HOT 3
- dynamic directive id HOT 1
- How is re-uploading resumed? HOT 2
- uploading the same file should be faster HOT 4
- why not use real filename for completed uploading HOT 2
- custom metadata is not working well HOT 2
- How to confirm before uploading via drop and drop HOT 2
- Support Angular 13 HOT 1
- How to append additional params to the request (service)? HOT 1
- throw error on using ngx-uploadx and uploadx-server with s3 HOT 1
- How to handle complete response HOT 2
- Drag and drop directory for upload
- Release date of next version HOT 1
- missing Metadata member HOT 2
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 ngx-uploadx.