Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

how to upload file using put in java

 
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Staff note (Liutauras Vilda) :

Fixed added code tags

 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to upload a file using put but its giving mew output like this
run:
OK
98
47
104
111
--- (TimM: deleted hundreds of lines)
115
116
115
39
44
1010
41
BUILD SUCCESSFUL (total time: 0 seconds)
 
Saloon Keeper
Posts: 7391
170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you printing out those numbers? I don't see how they're relevant (and I'm going to delete most of them now, as they provide no insight, and take up lots of space).
 
Tim Moores
Saloon Keeper
Posts: 7391
170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, I've added code tags to your first post. See how much better it looks? Please do that in the future when posting code of any length.
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks tim for the format and I'm printing the response code but file is not uploading to the web server
 
Tim Moores
Saloon Keeper
Posts: 7391
170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Those are not just the response codes - almost all of it is the output from line 46 - which is irrelevant for the purposes of uploading.

I see that in lines 36/37 you are suppressing an IOException without so much as printing a stack trace - how will you what problems there are? Don't ever do that.
 
Master Rancher
Posts: 4839
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm printing the response code


Those printed values look like the int values for ASCII characters.  Try casting the values that were read to char  to see what the contents of the server's response was:
 
Niti Kapoor
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks norm You save my day awsum
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic