0

A block of Html template looks something like this,

<div class="field" style="padding:1%">
            <label>Ledger Sample Copies</label>
        <input type="file" formControlName="savingsfile" [(ngModel)]="category.filepath" (change)= "FilePathHandler($event)" >

    </div>

and my respective component method looks like this,

FilePathHandler(fileName) {

  console.log("Files :",fileName.target.value);
  console.log("Files :",this.category.filepath);
}

I am trying to print and insert the path of any document selected from the file input into a database table.

But i am not able to display the filepath in the console.log.

The example output i got for the console logs are below,

Files : C:\fakepath\linux_java_eclipse.txt Files : undefined

I want to display the actual path of the file not with any fakepath.

could someone please help me out ?

I am working on ubuntu 7.14 machine if that helps out.

4
  • fileName.target.files[0] Commented Mar 6, 2018 at 5:18
  • this code displays an file object which does not contain the path of the document. I want the choosen file path. Commented Mar 6, 2018 at 5:22
  • tough this code prints the name of the file but i need the path as well.. Commented Mar 6, 2018 at 5:23
  • 1
    Possible duplicate of How to resolve the C:\fakepath? Commented Mar 6, 2018 at 15:57

1 Answer 1

1

I want to display the actual path of the file not with any fakepath.

For security reasons the actual path of selected document is not provided to websites. Only filename and a fake path is provided.

If interested in knowing more, please go through this thread.

How to resolve the C:\fakepath?

Sign up to request clarification or add additional context in comments.

Comments

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.