Search Posts

Category: image-upload

converting image source into file and append the file in rest api

I have an image source , i need to convert it into png file and append it to backend and send. upload is successfull ,but when we retrieve the stored file from backend , it has invalid file format error. I think it was not converted to base64 and because of this we have this issue. I am using $base64 dependency to covert my source. source = “data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAgAElEQVR4Xjy9Z6xlaXYdts6999ycc3o5p6pXVV3V1Xl6unt62CI5nCFFw6RoyIZtSDIMWTb8wyBk2DBgyYZ/CIT+SJRJGDJNWrboiRRnunu6OR0qp5fq5XRzzjkcY+03ozcoVNebV/eee8639157rbV3Kf/kj35XazbbsFrtqJSa2Ns9Qj5XQa8LOOw+mE0O1Kt9WCxOVCtN5HMlmMx==” $scope.uploadFile = function(source){ var imageBase64 = $base64.encode(source); […]

angular schema form image upload accepting all file types

I have used the this plugin Angular Schema Form and all the things are working as expected but for image upload i need to have validations so as to allow the users input only images. although the schema contains an accept attribute in the properties for image upload as follows: { “type”: “object”, “properties”: { “text1”: { “type”: “string”, “title”: “Untitled Text field”, “name”: “text1”, “url”: “http://localhost/image/upload/img59b7c29f1622b.jpeg” }, “file2”: { “type”: “object”, “format”: “file”, “title”: […]