Mrcrix 10 Posted November 7, 2016 Report Share Posted November 7, 2016 I'm doing a bot where based on interfaces created with "load HTML" , now I need to select one local file to be uploaded, the problem is that the HTML doesn't allow to get the full path of the file so I'm looking for a workaround without to use "ui html" but the simple "load html", I like to use a single tab and change the interfaces on the fly... Someone know how this could be done? I tried to use "ui open file" in "ui html" it works giving the full path but... I cannot find the way to show again the selected file when I come back in the same tab, is there a way to have the "ui open file" showing the file on the var? I tried with fillwith="value" but it's not working... any suggestion? Quote Link to post Share on other sites
deliter 203 Posted November 8, 2016 Report Share Posted November 8, 2016 this is from stackoverflow maybe not true but I trust their word For security reasons browsers do not allow this, i.e. JavaScript in browser has no access to the File System, however using HTML5 File API, only Firefox provides a mozFullPath property, but if you try to get the value it returns an empty string:$('input[type=file]').change(function () {console.log(this.files[0].mozFullPath);});http://jsfiddle.net/SCK5A/So don't waste your time.edit: If you need the file's path for reading a file you can use the FileReader API instead. Here is a related question on SO: Preview an image before it is uploaded. Quote Link to post Share on other sites
deliter 203 Posted November 8, 2016 Report Share Posted November 8, 2016 ayman has a file dialog picker plugin,I dont have it but with this you could certainly do it <button onClick='ubot.runScript("filePickerFunction()")'>pick file</button> and make a function that picks the file Quote Link to post Share on other sites
Mrcrix 10 Posted November 8, 2016 Author Report Share Posted November 8, 2016 Hi deliter thank you again!! I tried to use the FileReader API , it does work on an html ( http://jsfiddle.net/LvsYc/ ) file but it doesn't work on ubot, I tried with "load html" and with "UI html panel" but nothing to do... I saw the plugin, it does many things and it is a good plugin for sure but quite expensive just to pic a file I think I should move everything on UI HTML PANEL and use UI OPEN FILE... Thank you anyway! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.