ng-model does not work for input(type=file) by default. I made this angular directive for it: https://github.com/ghostbar/angular-file-model
(There's this factory too for uploading with easy ways to put new names to files and stuff which is compatible with angular-file-model as well https://github.com/ghostbar/angular-file-uploader/) Kind regards. On 4/28/14, 8:40 PM, Billy Figueroa wrote: > Hey fellas, > > So I already had this previously working when using normal form > submission but when I switched this code over to angularjs the files > selected are not being picked up. > > Here is my html > > <form class="form-horizontal" > enctype="multipart/form-data" ng-submit="update()"> > <div class="control-group"> > <label class="control-label" > for="bio">Bio</label> > <div class="controls"> > <textarea class="span6" rows="4" > type="text" name="bio" id="bio" ng-model="user.bio">{{ currUser.data.bio > }}</textarea> > </div> > </div> > <div class="control-group"> > <label class="control-label" > for="images">Upload Images</label> > <div id="input-wrap" class="controls"> > <input type="file" name="images[]" > id="images" ng-model="user.images" multiple> > <div id="fake_input"> > <input type="text" > class="file-place-holder" id="gallery-placeholder"> > <input class="btn > file-replacement-btn" type="submit" value="Browse"> > </div> > </div> > </div> > <div class="control-group"> > <label class="control-label" > for="profile_image">Upload Profile Image</label> > <div id="input-wrap" class="controls"> > <input type="file" > name="profile_image" id="profile_image" ng-model="user.profile_image"> > <div id="fake_input"> > <input type="text" > class="file-place-holder" id="profile-pic-placeholder"> > <input class="btn > file-replacement-btn" type="submit" value="Browse"> > </div> > </div> > </div> > <div class="control-group"> > <input class="span2 btn btn-success > btn-large offset1" type="submit" value="Update"> > </div> > </form> > > how have some of you handled file uploads? I don't see any "default" > angularjs way of handling this > > if this is a repost, which it may be as I have to assume this is a known > issue, please refer me to the original post as I couldnt find one > > -- > You received this message because you are subscribed to the Google > Groups "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. -- Jose Luis Rivas - http://joseluisrivas.net Venezuela - GPG: 0xB9AC8C43 -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
