Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Diego 22 posts 153 karma points
    1 week ago
    Diego
    0

    Hello everyone, i need the member to be able to upload files via the front-end (png/jpg or pdf image type). So I created a form that contains the <input type="file" id="inputFile" name="inputFile"/> tag.

    These files need to be converted to base64, but to do this I need the client path of file. The problem arises from the fact that the path I acquire is something like this: C:\fakepath\filename.jpg.

    How can this problem be circumvented? An alternative idea on file upload?

    Thank you very much.

  • Diego 22 posts 153 karma points
    1 week ago
    Diego
    100

    I solved everything via javascript. It seems to be the only method to overcome the browser security system by masking the client path of the file. To those who may find it useful, I leave a link:

    https://stackoverflow.com/questions/6150289/how-can-i-convert-an-image-into-base64-string-using-javascript

Please Sign in or register to post replies

Write your reply to:

Draft