Poco HTMLForm image upload

Was wondering if anyone has worked with images and HTMLForms in poco. I have been reading about the partSource object I think that is the way you get attachments into a Poco Form. Shiffman has a great example for uploading photos in Processing I guess the goal would be to have this in OF.

I update Chris’s HTTPUtils to use the built in Poco events in OF. Anyway if anyone can guide me in the write direction I would be pumped.

http://www.shiffman.net/2006/05/02/upload/
http://pocoproject.org/docs/Poco.Net.PartSource.html
http://toddvanderlin.com/OF/HTTP%20Utils.zip

hey todd

i did this for the grand mutual smiles project with pierre, the version of httputils that allows to post files is here:

http://github.com/arturoc/ofxHttpUtils

This is great. _ have tried a few things not sure how this is working, not a lot of documentation online.

i tried to make the action just a folder on my server
and then tried to call this php file (standard) file upload
http://www.w3schools.com/PHP/php-file-upload.asp

example ??

  
ofxHttpForm form;  
		form.action = "[http://www.vanderlin.cc/test/upload.php";](http://www.vanderlin.cc/test/upload.php";)  
		form.addFormField("form", "true");  
		form.addFile("file", "/Users/todd/Desktop/test.png");  
	  
		httpUtils.submitForm(form);  

Any idea what the setup should be. :slight_smile:

mmh, yeah that should be working, the example form doesn’t have a form field but the code should work even with that.

it’s been a while since i don’t use it but will give it a try later

i think it’s just you’re missing the method for sending the request, when sending files you need to select post:

  
	form.method = OFX_HTTP_POST;  

i’ve uploaded an example too.

Hmm still having issues with this. I get a fine response back from my server when I have no file added to the form. I get a timeout / beachball when trying to add a file. Have you tried this on server and not locally.