0

Is there any way to upload files without using formdata in Angular Js. I have checked the below links, which have not helped:

I do not want to use any plug-in, and cannot use iframes. I want to upload single file. I have the service created as below, to which I have to pass the image data.

myAPIService.postUploadImage = function (formdata) {
        var request = {
            url: urlBase + 'UploadImage',
            method: 'POST',
            data: formdata,
            headers: {
                'Content-Type': undefined
            }

        }
        return $http(request);
    };

The UI is defined as below:

<input type="file" class="form-control" id="imageUploadfile" name="Imagefile" accept="image/*" />
 <input type="button" name="imageUploadButton" ng-click="uploadFiles()" value="Upload" />

Requesting Admin/moderators to not mark it as duplicate, as I have tried most of the links, but that has not worked.

How to upload single file in AngularJS without using plugins,iframe and which works in IE 11, Chrome. Thanks

5
  • Try ng-flow. Its very nice plugin, with minimal setup. Commented Jan 11, 2017 at 15:31
  • Is there no other way, other than using a plugin? I would like to do a simple upload without using plugin or iframe. Thanks Commented Jan 11, 2017 at 16:26
  • You can use jquery to upload the files. See this abandon.ie/notebook/simple-file-uploads-using-jquery-ajax Commented Jan 12, 2017 at 6:55
  • Hi @Majid.. The URL which you have provided uses formdata, which I do not want to use Commented Jan 12, 2017 at 7:52
  • @venkat14 have you got the solution? Commented May 28, 2021 at 4:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.