I need to create a greasemonkey userscript which can get the path of an uploaded image, store it, and then set it on a different page's upload input.
As far as I understand it is not possible to figure out the file path on an input type=file with javascript alone.
But is this possible with greasemonkey?
How close can I get to the desired functionality and what options do I have?
So far I have tried to access the input's value via val() but it doesn't work at all.
EDIT:
If I can't get the path, can I at least set it, provided I always use the same folder?
Unfortunately I've not used GreaseMonkey before, but based purely on this line
Allows you to customize the way a web page displays or behaves, by using small bits of JavaScript.
I'd suggest it's not possible. To understand why, you have to understand the reasoning behind the security measures. Imagine JavaScript was able to read/write to the input[type='file'], malicious JavaScript could automatically create a form, create the file input, set it's value to something like c:\\\Windows\\System32\\Some Sensitive File, and then post the form, all without your consent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With