2 Responses to “MHTTPFilePoster Library”

Hi,
i’m new to Processing and Mobile Processing and i found out very hard to find stuff related to Mobile Processing over the internet, so i tried to put together some notes and write a few lines about the MHTTPFilePoster library, a kind of reference, maybe it helps someone that is passing trought the same i passed, if you like it and think it can be usefull to someone, you can use it (maybe link to it or post it in the library page), feel free to correct any mistakes i made. Once again, thank you for your library, it was very helpfull to me.

Here it goes: (i tried to explain in order what you need to have in your sketch to use the library)

import com.mobvcasting.mhttpfileposter.*;

Imports the library into the sketch.

MHTTPFilePoster poster;

Declares the element “poster” as a MHTTPFilePoster type where “poster” could be any valid variable.

Assigns the information required to file uploading to the “poster”.
midlet: the sketch that will upload the file, generally use “this”.
url: url of the form that will receive the file (example at http://itp.nyu.edu/~sve204/mobilemedia/week3.html).
filename: name of the file that is beeing uploaded, include the extension (example: “image.jpg”)
form’s input element: the name of the form’s element that will receive the file (example: “bytes” in the form at http://itp.nyu.edu/~sve204/mobilemedia/week3.html)
byte[ ] var: the name of the byte[] type var that contais the data that will be uploaded as a file.
formvars: the vars explained above.

poster.startUpload();

Uploads the file as declaired above.

poster.getStatus();

Returns an integer with the status of the file upload where:
0: Not Started.
1: Started.
2: Complete.
3: Error during upload.