file-upload

Upload angularjs file with progress percentage

跟風遠走 提交于 2020-02-04 03:00:21
问题 In my webapp i've got a service to upload files using angularjs and multipart upload. This is an example: https://jsfiddle.net/ZG9re/3909/ It works perfectly but i can't understand how could see the percentage of the file during the upload. I don't want use XMLHttpRequest but i need to mantain this code if possible. This is the code anyway: var myApp = angular.module('myApp', []); myApp.directive('fileModel', ['$parse', function ($parse) { return { restrict: 'A', link: function(scope, element

Upload angularjs file with progress percentage

人盡茶涼 提交于 2020-02-04 02:59:32
问题 In my webapp i've got a service to upload files using angularjs and multipart upload. This is an example: https://jsfiddle.net/ZG9re/3909/ It works perfectly but i can't understand how could see the percentage of the file during the upload. I don't want use XMLHttpRequest but i need to mantain this code if possible. This is the code anyway: var myApp = angular.module('myApp', []); myApp.directive('fileModel', ['$parse', function ($parse) { return { restrict: 'A', link: function(scope, element

Upload File as multipart/form-data from Angular with ngx-mat-file-input

风流意气都作罢 提交于 2020-02-02 14:47:12
问题 I'm using ngx-mat-file-input [0] to retrieve a file input from the user and I want to upload it to a server. The endpoint expects a multipart-file. How can I do this? [0] https://www.npmjs.com/package/ngx-material-file-input 回答1: If you're using <ngx-mat-file-input> with an reactive form it will give you back an object with a 'files' array. The elements of this array have the type 'File'. A File extends the Blob interface [0][1]. The Blob is what you need to send to the server. First step:

Upload File as multipart/form-data from Angular with ngx-mat-file-input

匆匆过客 提交于 2020-02-02 14:46:48
问题 I'm using ngx-mat-file-input [0] to retrieve a file input from the user and I want to upload it to a server. The endpoint expects a multipart-file. How can I do this? [0] https://www.npmjs.com/package/ngx-material-file-input 回答1: If you're using <ngx-mat-file-input> with an reactive form it will give you back an object with a 'files' array. The elements of this array have the type 'File'. A File extends the Blob interface [0][1]. The Blob is what you need to send to the server. First step:

Convert blob to image file

倾然丶 夕夏残阳落幕 提交于 2020-02-02 13:32:15
问题 I am trying to convert an image file captured from an input type=file element without success. Below is my javascript code var img = document.getElementById('myimage'); var file = document.querySelector('input[type=file]').files[0]; var reader = new FileReader(); reader.addEventListener("load", function () { var theBlob = reader.result; theBlob.lastModifiedDate = new Date(); theBlob.name = file; img.src = theBlob; var newfile = new File([theBlob], "c:files/myfile.jpg"); }, false); if (file) {

Vuetify File Uploads

一世执手 提交于 2020-02-02 11:12:39
问题 I'm trying to upload a file in Vue.js using vuetify and then save the uploaded file in my data object. HTML: <input id="file-upload" type="file" @change="onFileChange"> In my methods I call: onFileChange(e) { var files = e.target.files || e.dataTransfer.files; if (!files.length) { return; } this.editedPerson.id_file = e.target.files[0].name; }, This works 100%. I do, however, want to use the Vuetify component: <v-btn color="blue-grey" class="white--text" @click.native="openFileDialog">Upload

select multiple files in django with single filefield

巧了我就是萌 提交于 2020-02-01 09:05:28
问题 How can I select multiple files in a single fileField in django? I want to select different file formats in a single filefiled in django admin. **models.py** class FileModel(models.Model): name = models.CharField(max_length=100) file_upload = models.FileField(upload_to=settings=PATH) **admin.py** admin.site.register(FileModel,FileAdmin); In the admin I want to customize the file field to select multiple files to store in given path? Could you please help me? 回答1: You can't? The FileField was

Multiple images upload to Bucket AWS S3 using swift

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-01 08:46:21
问题 I am tryin to upload an image to bucket AWS s3 using below code. let ext = "jpeg" let uploadRequest = AWSS3TransferManagerUploadRequest() uploadRequest?.acl = .publicRead uploadRequest?.body = URL(fileURLWithPath: path) uploadRequest?.key = s3BucketKey uploadRequest?.bucket = S3BucketName uploadRequest?.contentType = "image/" + ext DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async { let transferManager = AWSS3TransferManager.default() transferManager.upload(uploadRequest!)

Multiple images upload to Bucket AWS S3 using swift

依然范特西╮ 提交于 2020-02-01 08:46:08
问题 I am tryin to upload an image to bucket AWS s3 using below code. let ext = "jpeg" let uploadRequest = AWSS3TransferManagerUploadRequest() uploadRequest?.acl = .publicRead uploadRequest?.body = URL(fileURLWithPath: path) uploadRequest?.key = s3BucketKey uploadRequest?.bucket = S3BucketName uploadRequest?.contentType = "image/" + ext DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async { let transferManager = AWSS3TransferManager.default() transferManager.upload(uploadRequest!)

Checking file type from base64?

心不动则不痛 提交于 2020-01-31 16:56:59
问题 I have a WCF REST Service with the following OperationContract that saves files on the disk: [OperationContract] [WebInvoke(UriTemplate = "FileSave", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] ResponseHandler FileSave(string fileName, string fileContent); Files are sent through javascript - using HTML File API => binary data => base-64 encoded ASCII string (=fileContent is recieved in the