• 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

Help needed for File Uploading code...

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,

I need a help. I had made a swing component for file drag and drop. I used JTabbedPane and when user drag any file from FileChooser or Local Desktop Location and drop it to the Tabbed Pane, It displays the contents of the file on a tab.
Program is working perfectly fine.

Now what i want, if any user drag the file and drops it over the component, It should display the name of the file instead of displaying the entire contents. Basically this code is for Uploading the file to the server.

Any sort of help or guidance or clue...most welcome..

Thanx a lot..

Regards
Shalini
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can open a Socket to the Server and Write the file content to the output stream.

I assume displaying the filename must be easy.
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shalini,

I dunno exactly what you are looking for but the following worked for me:

1> add a TransferHandler to your JComponent say JTree or JTable


2> make myTransferHandler extend TranferHandler and overload importData()


Hope this helps...
 
Shalini Chandel
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanx a lot Ravi....
I tried that and it works fine...
What I want was How the file would be uploaded to the server...I guess i have to do socket programming for that...

regards,
Shalini
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic