Reputation: 5921
I am trying to upload the large file(let's consider Human Genome tar file, minimum 2.5gb) using Angular. If I upload it from Linux(in any browser, chrome or Firefox) it is working, But same file upload not working on windows (even chrome browser). Following is a service file,
import { HttpHeaders, HttpClient, HttpParams, HttpEventType } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class GenomeService {
baseApiUrl = '###myapiurl###';
public postGenome = (resrc: string, item: any): Observable<any> => {
this.headers = this.headers.delete('Content-Type');
return this._http.post(this.baseApiUrl + resrc + "/", item, {
headers: this.headers,
withCredentials: true,
reportProgress: true,
observe: 'events'
}).pipe(
map((event) => {
switch (event.type) {
case HttpEventType.UploadProgress:
const progress = Math.round(100 * event.loaded / event.total);
return { status: 'progress', message: progress };
case HttpEventType.Response:
return event.body;
default:
return "Error......${event.type}";
}
}),
finalize(() => {
console.log("done");
})
);
}
}
In the browser network tabit is showing as net::ERR_CONNECTION_RESET
. I don't know, where I am making the mistake..?
Upvotes: 1
Views: 214
Reputation: 12050
If you are using IIS
for hosting your application, then the default upload file size if 4MB
. To increase it, use this below section in your web.config
.
Note: maxAllowedContentLength
is measured in bytes
while maxRequestLength
is measured in kilobytes
which is why the values differ in this config
example:
<system.webServer>
<security>
<requestFiltering>
<!-- For 50 MB set maxAllowedContentLength="52428800" -->
<requestLimits maxAllowedContentLength="52428800" />
</requestFiltering>
</security>
</system.webServer>
<!--For 50 MB set maxRequestLength="51200"-->
<httpRuntime targetFramework="4.5" maxRequestLength="51200" executionTimeout="30" />
Upvotes: 1
Reputation: 367
Check ( on your backend' ssettings ) some parameter called maxRequestSize or maxRequestLength. It would have been easier if we know what kind of backend you're using. If it's DOT NET, it would be something like this :
<httpRuntime maxRequestLength="xxx" />
set it depending to your needs
Upvotes: 3