• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to transfer images to ftp server in android

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am unable to connect to ftp server from andriod phone..a simple java application to upload image to server is running fine...but the same in andriod is not working
please help me....i want to connect to the server using andriod app only


thankyou
 
Greenhorn
Posts: 9
Android
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does logcat say?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And please post the code you are using to do the upload.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We need to view your code.

The java program doing the upload uses a set of libraries/ apis which OBVIOUSLY don't work in android.

Alternatively, fire-up another file upload app (with startActivity) and receive the response in your logic..
 
Greenhorn
Posts: 15
Mac Objective C Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are several things that could be causing that. Can we see your code? Make sure you set the right permissions in the manifest, such as internet access for example.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thankyou for the reply,

i am using andriod 2.1,i have posted my code here
jar i have used is:(org.apache.commons.net_2.0.0.v200905272248.jar)
i have also given the internet permission in manifest file.
please see through the code and help because iam unsuccessful to do this since long

1.mainactivity





2.filetransfer class which is called inside mainactivity
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my logcat says:



unable to get that..please help
i am trying to send images from my sdcard to the ftp server..
Is this problem only in emulator??
 
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Caused by: java.lang.ClassNotFoundException: myapp.test.AndriodTestActivity


Does your app have such a class? The code you posted doesn't.
 
Don Ho
Greenhorn
Posts: 9
Android
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you also post your AndroidManifest.xml?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dat log cat i posted was different.sory for wrong post..
please see the code and tell me what could be wrong.is this problem of version or emulator?
AndriodManifest.xml

 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What problem? Is there an exception? If so, post the logcat output. If there's no exception, tell us what the code does right now, and how that differs from what you expected it to do.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the log cat shows



i want to send the image i select from the sdcard to the ftp server i mentioned.
the problem is the image is not uploaded to the server.
i am running on android version 4.0.3


please suggest
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the error log, it says could not connect to host 67.15.35.194.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you tell what might be the reason..??
is something wrong in the coding?

iam unable to resolve for a while now
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a network problem. Can you ping that host from the device?
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Tim has said it's a network issue, and port 8080 is typically a http port. Try to connect using the default ftp port.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to ping on a virtual device?

 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i changed the port to 21 now still it is not working..
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the error log say same?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
log cat says...

 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope the password you quoted earlier is a dummy password; if no you ought to go back and change the post.
Please don’t post long lines in code tags; I have had to edit your stack traces so they are legible without too much left and right scrolling.
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

suzzane pinto wrote:how to ping on a virtual device?


There are any number of Ping apps in the Android Market; some of them are bound to be available as .apk files from their developers in case you don't have access to the Android Market.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
unable to get the exception in the logcat?
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
print a stack trace, this might give a better explanation of the cause
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now dat i have used another piece of code my image is getting uploaded to server but not clearly,image is not clear

the code i used are
1.MainActivity



2.ProgressInputStream





logcat says:







please suggest

 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So which object is null?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
m not getting it.....
 
Andrew Moko
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
at com.myapp.test.ProgressInputStream.sendLong(ProgressInputStream.java:76)
 
Andrew Moko
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see the Handler progressHandler in the MainActivity class being initialized. Learn to read and follow through the error stack messages.
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now i am able to uplaod images from emulator,but while i run in my mobile device the image is not uploaded...
i recognized that the problem is in getting the absolute path of image before uploading....can you tell me hw to get the image from relative path???
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This should help: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my problem is he app is running fine on virtual device but not in the actual device.
what might be the problem???
when i run from my avd it takes image from the sdcard n then send to server. but in mobile it allows to select from its sdcard and when selected it doesnt upload


any idea why is it so??
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the device has a proper network connectivity?
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At which step of the code does the execution start to differ on the real device?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
nw it is running from device also i just used following code



now i observed that...images from mobile are loaded incompltly(half image)...whereas from avd upto image sized upto 7b where loaded successfully
is size a problem or something else?

 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone reply to my post...
will adding progress bar solve my problem of loading incomplete img.....
what can be done??
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A progress bar is just for providing user feedback; it has no bearing on the actual operation.

What about the question I asked earlier?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually i observed later that both from the avd and the mobile images greater than 7kb are not getting uploaded...
i need some solution over that..
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
will creating a diff thread solve my problem?? may be the UI thread is not taking load....
please correct if i am wrong and do suggest something
 
Tim Moores
Saloon Keeper
Posts: 7582
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lengthy operations should definitely not be run in the UI thread. That's what AsyncTask is for: http://developer.android.com/resources/articles/painless-threading.html, http://mobileorchard.com/android-app-developmentthreading-part-2-async-tasks/
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic