Well, it looks to me like the author re-invented the wheel. It's quite
easy to post an image to a server. Here's some code in one of my
applications that has been modified to be more generic. I didn't test
the modifications, but it should work. Note that I'm posting both the
file (videoFile) and a text description of it (videoName)
String response = null;
String TAG = "ERROR";
PostMethod method;
try {
HttpClient client = new HttpClient();
client.getHttpConnectionManager().getParams().setConnectionTimeout(
5000);
method = new PostMethod(urlString);
Part[] parts = {
new FilePart("videoFile", new
ByteArrayPartSource(
"videoFile", data)),
new StringPart("videoName", filename) };
method.setRequestEntity(new
MultipartRequestEntity(parts, method
.getParams()));
client.executeMethod(method);
response = method.getResponseBodyAsString();
method.releaseConnection();
} catch (Exception ex) {
Log.v(TAG, "Exception", ex);
} finally {
method.releaseConnection();
}
return response;
On Apr 16, 10:26 am, "Bryan.paul" <[EMAIL PROTECTED]> wrote:
> I posted this in beginners and got no response, but it appears this
> group is far more active; I hope this doesn't offend anyone.
>
> I have been reading a lot of documentation, and I'm looking to start
> building my application very soon. However, I'm not sure how I want to
> handle a key aspect of it, and I want to get it straightened out
> before I get too far in the development process:
>
> I want users to be able to upload a file from their handset to my
> webpage. I have a shared hosting plan (at least now), and I'm mainly
> working in PHP and MySQL serverside. What would be the best way to
> handle this transaction? I'm flexible and I'm open to any options.
> I have very limited experience with file transfers, and I'm not sure
> how to best jump this hurdle. I'd like to not have to rely on them
> using the browser and a form, but keep the entire upload within the
> application itself on Android. But then I'm not sure how I would set
> this up with my website.
>
> I did find this
> here:http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-p...
> It shows both the webserver and android end to uploading a file. Any
> other input is still appreciated, although this may be what I
> was looking for. So I know it's possible, just need to dissect the
> code and make sure this is the most efficient and best way to do
> this.
>
> Any and all feedback is appreciated, and even
> something to suggest for me to research on my own would be great.
> Thanks in advance for your time and consideration.
>
> Bryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---