Hii,
i want to let the user choose a picture on his local drives and load it into my unity app (webbrowser).
i managed to have it working on IExplorer(only on local), using a form to get the filepath.
but Online, with IE,FireWorks, Chrome, Opera… there is a lock that hide the complete file path…
i can only access the filename… not the fullpath filname.
so i can’t use www class to load my picture…
does anybody know a way to perform the image loading into my app ?
how can i get the corect fullpath to the user picture into my unityapp ?
Ehhhh, I’ve done it recently with a side-by-side Silverlight application which reads the image bytes and feeds those bytes to the Unity instance via JavaScript. It’s a bit of a convoluted method; perhaps there’s an easier way with pure JavaScript/form posting, but I’m not sure.
EDIT: also, this isn’t strictly a Firefox3 “problem”; this is a fundamental web-browser security restriction.
Short of using some server-side script (where the user uploads their picture onto the server), you’d probably have to use some other plugin that can read the bytes of a file that the user picks. Both Flash and Silverlight can read files that the user picks and can feed those to unity via a JavaScript call (provided you wrap the bytes as Base64 encoded strings)
Told you it was convoluted! I hope there’s an easier way.
No there is no easier way. But generally you have a webplayer game on a website and if you offer such personalization you would want some community to bind the user so uploading it there to get it from there should be rather “natural” actually
so i think i will use a huge php/MySql system to upload a temporary picture on my server then ask unity’s www to go and check for img. and delete when loaded (as i don’t want them to be persistent). but i’m not really good at php…
by the way…if some one have a super (and easy) solution… let me know.
If they’re temporary, you can skip the MySQL DB part by reading/writing them to the server’s file system instead.
EDIT: It’d be nice if in a future version of Unity, it adds the ability for the player to use standard open/save dialogue boxes to be able to read/write bytes in a secure fashion similar to how Flash and Silverlight implemented it. Perhaps something to suggest to the Unity development team.