Loading...
Logo
Processing Forum

http POST file upload

in Programming Questions  •  1 year ago  
i've looked already into Philippe's code here:
Upload.php
ImageUpload.pde
DataUpload.java

and seltar here:
http://libraries.seltar.org/postToWeb/

after some struggling i've been able to modifie the code to suite my needs and make it work,
nothing fancy, just passing some new user defined params along with the file,

but i'm not able to upload gz files , only text files and images,

can someone point me in the right direction? am i missing something here?
by the way, i can upload gz files, but it seems it goes up with the wrong encoding,
and at the end, the is corrupted and not compressed.

i have the fealing the problems is somewere around here

Copy code
  1.         String file = join(loadStrings("20120207.gz"),"");


            upload("new_folder",url,"20120207.gz",file.getBytes());

because is reading a string type, not binary file.

i tried to change the headers to application/gzip, but errors ocured.

please help.



maxtrix.net

Replies(1)

Indeed, using loadStrings and join on a binary file is deeply wrong!
From memory, you have to use something like:
BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename), 32768);
but you have to use a try/catch/finally ceremony around it (that's Java!).
createInput() can simplify this a bit.