• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic