Search code examples
reactjsdropzone

Get local file path in React Dropzone


Can anyone help me to let me know, how can I get to know the local file-path while uploading it through React-Dropzone in React.js?


Solution

  • Getting the local file path of client is not permitted by browsers as it is a security risk. Some browsers only return the file name whereas some might return something like

    C:/fakepath/filename
    

    The browser will take care of the upload. Your web site doesn't need to know the full path of the file on client's machine. No one wants their local disk structure exposed on the web.

    In short, it's not possible. It might help if you can explain why you want the full path?