Hi,
I have have made some minor changes to the curl plugin so that write functions
perform upload via HTTP POST with "multipart/form-data" encoding. i.e. exactly
the same upload you get from a web browser when submitting a form with <input
type="file">.
Usage example:
osg::Image* image = osgDB::readImageFile("Images/reflect.rgb");
osgDB::writeImageFile(*image,
"http://myserver/upload/upload.asp?filename=myuploadedimage.jpg");
Of course, to make this do anything useful, you need to implement the server
side script to handle the posted form, but thats pretty standard stuff for any
one doing web server-side work.
Oh...and one little quirk I noticed is, the osgDB::Registry write functions do
not fall back to "curl" like the read functions, so you need to ensure the curl
plugin is loaded before calling the write functions.
(e.g. osgDB::Registry::instance()->getReaderWriterForExtension("curl");)
Unfortunately I did also have to make a tiny change to registry header to give
access to the mime type extension map so the curl plugin can do a reverse
lookup to find mime type for extension.
I'm pretty sure may changes will leave the read functions of the curl plugin
completely unaffected (though I have moved some small sections of code around
to share between read and write functions).
My submission is based on
checkout of "tags/OpenSceneGraph-2.9.11" at revision [12229]
Cheers,
Chris
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=40816#40816
Attachments:
http://forum.openscenegraph.org//files/readerwritercurl_233.h
http://forum.openscenegraph.org//files/readerwritercurl_179.cpp
http://forum.openscenegraph.org//files/599_1308850137._340.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org