Pure ASP upload with image detection

Here is a single Class which handles file upload plus image detection. Use case will come below. Save this as-is, preferably as a new file, with .asp extension e.g. ShadowUpload.asp Note: if you want to allow uploading images larger than 200kb, take a look in the answer to Request.BinaryRead(Request.TotalBytes) throws error for large files. (Failing … Read more

How to avoid OutOfMemoryError when uploading a large file using Jersey client

You could use streams.Try something like this on the client: InputStream fileInStream = new FileInputStream(fileName); String sContentDisposition = “attachment; filename=\”” + fileName.getName()+”\””; WebResource fileResource = a_client.resource(a_sUrl); ClientResponse response = fileResource.type(MediaType.APPLICATION_OCTET_STREAM) .header(“Content-Disposition”, sContentDisposition) .post(ClientResponse.class, fileInStream); with resource like this on the server: @PUT @Consumes(“application/octet-stream”) public Response putFile(@Context HttpServletRequest a_request, @PathParam(“fileId”) long a_fileId, InputStream a_fileInputStream) throws Throwable … Read more

How to upload file in Angular2

In fact, the Http class doesn’t support that at the moment. You need to leverage the underlying XHR object to do that: import {Injectable} from ‘angular2/core’; import {Observable} from ‘rxjs/Rx’; @Injectable() export class UploadService { constructor () { this.progress$ = Observable.create(observer => { this.progressObserver = observer }).share(); } private makeFileRequest (url: string, params: string[], files: … Read more