Forum

HTTP (Network Post) to upload image?

I’m trying to post an image from my hard drive to a server using the HTTP (Network Post), but I’m not quite sure how to go about sending the image. I’ve changed the mime-type to image/jpeg and the encoding to mutlipart/formdata. For the “value” of the image I’m just sending the reference to the file on my hard drive. I’m trying to access the posted image in $_FILES in my PHP script, but it’s saying it doesn’t exist. Is there anything I’m missing here?

Instead of sending a reference to a file on your hd, you have to send the “file” itself. You can load an image using Reader(File), the resulting string has to be used as input for the value-pin. Also have a look at AsString(EX9.Texture)

Ah hah!!! I knew I had to somehow send the data and not just the reference, but I didn’t know how. Thanks a lot, I’ll give those a try :)

small hint:
don’t hover AsString (EX9.Texture) 's output pin.
the tooltip slows down your system a little bit.
you may think that vvvv’s frozen…

Hmm, I guess this didn’t solve all my problems.

It seems that the file doesn’t show up in the $_FILES array in PHP when submitted like this. Does anyone have any tips for working with this on the server side? (specifically with PHP)

Hmm, after doing some reading I would try using fwrite to write the image file, but for some reason it seems like my PHP script is only receiving the first 4 bytes of data, which are ÿØÿà. I’ve tried both the AsString(EX9.Texture) and the Reader(File) with the same results. I suspect it has something to do with my PHP script. Does anyone have a pointer?

We have the same problem here… just “ÿØÿà”
Anyone? Help?

see Image upload with node http (network post)