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?
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:
Fakepath
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.
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
is working on a reply...