3
  <div id="image-preview">
    <input type='file'  data-ng-file-select  onchange="scope.setFile(this)" id="imgInp">
        {{theFile.name}}
    <img id="blah" src="{{imgeSrc}}" alt="Upload your picture" />

    </br>

    </div>

window.scope = $scope;
    $scope.name = 'Superhero';

    $scope.setFile = function (element) {
        $scope.$apply(function () {
            $scope.file = element.files[0];
            //$scope.file = (element.srcElement || element.target).files[0];
            console.log($scope.file);

        });
    };
/*for image upload*/
#image-preview {
    width: 465px;
    height: 250px;
    position: relative;
    overflow: hidden;
    background-color: #FFFFFF;
    color: #5D5E5E;
    margin-top:10px;
    border: dotted 3px #bdc3c7;
}
#imgInp {
    line-height: 200px;
    font-size: 200px;
    position: absolute;
    opacity: 0;
    z-index: 10;
  }
 #blah {
    position: absolute;
    z-index: 5;
    opacity: 0.8;
    cursor: pointer;
    background-color: #FFFFFF;
    width: 465px;
    height:250px;
    font-size: 20px;
    line-height: 50px;
    text-transform: uppercase;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    text-align: center;
  }
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js"></script>
<div id="image-preview">
 
    
    <input type='file'  data-ng-file-select  onchange="scope.setFile(this)" id="imgInp">
            
    
    {{theFile.name}}
        
    
    
 <img id="blah" src="{{imgeSrc}}" alt="Upload your picture" />
       

  </div>

here is what i did for angular js i have my controller in that i wrote that

now i am able to get file name but i would like to know is it possible to get full path of that image i know in php but in angularjs its some what new to me can i get any help

i would like to preview the user uploaded image with image tag with same input tag

Saida Rao
  • 109
  • 1
  • 12
  • It looks like you don't actually want the full path (which isn't exposed by the browser), you want to be able to preview the image before it's uploaded. See http://stackoverflow.com/questions/18754943/preview-image-before-uploading-angularjs – Daniel Beck Mar 16 '16 at 15:29

1 Answers1

4

No. Web browsers prevent it for security.

Bear Vast
  • 150
  • 1
  • 8