angularjs-fileupload

AngularJS Unable to display upload file logs [duplicate]

我只是一个虾纸丫 提交于 2020-01-22 04:02:26
问题 This question already has answers here : ng-model for `<input type=“file”/>` (with directive DEMO) (12 answers) Closed 24 days ago . I am trying to create a file upload function using angularjs which will just accept the file and send it to the server side (Django). To ensure the file upload function is working fine, I've placed multiple console.log in multiple locations. However, none of the logs are displayed. This are my codes: .html: <body ng-app="myApp" ng-controller="appCtrl"> <input

ng-model for `<input type=“file”/>` (with directive DEMO)

旧街凉风 提交于 2019-12-24 00:08:21
问题 I tried to use ng-model on input tag with type file: <input type="file" ng-model="vm.uploadme" /> But after selecting a file, in controller, $scope.vm.uploadme is still undefined. How do I get the selected file in my controller? 回答1: I created a workaround with directive: .directive("fileread", [function () { return { scope: { fileread: "=" }, link: function (scope, element, attributes) { element.bind("change", function (changeEvent) { var reader = new FileReader(); reader.onload = function

Laravel storing only one file from multiple file upload file using AngularJS

冷暖自知 提交于 2019-12-20 04:20:04
问题 Good morning or good evening (it depends whenever you read this topic). I wrote this code using angular and laravel to upload multiple files, but what i get from the request is only one file object, and all others are discharged, for this reason in laravel controller doesn't loop in foreach and return undefined. Please leave me a feedback HTML <input ng-file-model = "files" value="Seleziona file" type="file" name = "file[]" class="btn btn-info btn-s" multiple /> Controller (AngularJS) $scope

How to make POST requests with the FormData API

旧城冷巷雨未停 提交于 2019-12-17 05:15:12
问题 I want to pass the username and form_data object to the php file using http.post when i pass only form_data it works my picture upload. but i want to pass some other information like username as well. please help me how to pass other data in http.post And here is my php file. <?php include "connectdb.php"; $data=json_decode(file_get_contents("php://input")); $name=$dbhandle->real_escape_string($data->susername); if (!empty($_FILES)) { $date=2; $path = 'fooditem/'. $_FILES['file']['name']; if

How to make POST requests with the FormData API

天涯浪子 提交于 2019-12-17 05:15:04
问题 I want to pass the username and form_data object to the php file using http.post when i pass only form_data it works my picture upload. but i want to pass some other information like username as well. please help me how to pass other data in http.post And here is my php file. <?php include "connectdb.php"; $data=json_decode(file_get_contents("php://input")); $name=$dbhandle->real_escape_string($data->susername); if (!empty($_FILES)) { $date=2; $path = 'fooditem/'. $_FILES['file']['name']; if

AngularJS Upload Multiple Files with FormData API

落爺英雄遲暮 提交于 2019-12-17 02:52:07
问题 I need to upload image and video files to the server in an Angular application using Laravel 5.1 as the back end. All Ajax requests need to go to the Laravel controller first, and we have the code there for how the file gets handled when it gets there. We have previously done normal HTML forms to submit file uploads to the controller, but in this case we need to avoid the page refresh of a form, so I am attempting this in Ajax through Angular. What information do I need to send to the Laravel

Angular upload - error 405 When Sending FormData [duplicate]

落爺英雄遲暮 提交于 2019-12-02 08:54:58
问题 This question already has answers here : $http.post: Large files do not work (2 answers) Closed last year . I am trying to upload a file with angular and I am getting post result 405. After researching in internet I found out that this is a response when the method is not allowed. I can not figure out why I am getting this error. Thanks in advance for the help. HTML <input type="file" file-model="myFile" /> <button ng-click="uploadFile()">upload me</button> Directive MyApp.directive(

AngularJS Uploading An Image With ng-upload

爷,独闯天下 提交于 2019-11-27 10:57:19
I am trying to upload a file in AngularJS using ng-upload but I am running into issues. My html looks like this: <div class="create-article" ng-controller="PostCreateCtrl"> <form ng-upload method="post" enctype="multipart/form-data" action="/write" > <fieldset> <label>Category</label> <select name="category_id" class=""> <option value="0">Select A Category</option> <?php foreach($categories as $category): ?> <option value="<?= $category -> category_id; ?>"><?= $category -> category_name; ?></option> <?php endforeach; ?> </select> <label>Title</label> <input type="text" class="title span5" name

AngularJS Upload Multiple Files with FormData API

て烟熏妆下的殇ゞ 提交于 2019-11-26 18:01:18
I need to upload image and video files to the server in an Angular application using Laravel 5.1 as the back end. All Ajax requests need to go to the Laravel controller first, and we have the code there for how the file gets handled when it gets there. We have previously done normal HTML forms to submit file uploads to the controller, but in this case we need to avoid the page refresh of a form, so I am attempting this in Ajax through Angular. What information do I need to send to the Laravel controller with Ajax that was being sent to the controller via an HTML form previously? This is the

AngularJS Uploading An Image With ng-upload

一世执手 提交于 2019-11-26 15:20:45
问题 I am trying to upload a file in AngularJS using ng-upload but I am running into issues. My html looks like this: <div class="create-article" ng-controller="PostCreateCtrl"> <form ng-upload method="post" enctype="multipart/form-data" action="/write" > <fieldset> <label>Category</label> <select name="category_id" class=""> <option value="0">Select A Category</option> <?php foreach($categories as $category): ?> <option value="<?= $category -> category_id; ?>"><?= $category -> category_name; ?><