File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Help needed for File Uploading code... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help needed for File Uploading code..." Watch "Help needed for File Uploading code..." New topic
Author

Help needed for File Uploading code...

Shalini Chandel
Ranch Hand

Joined: May 05, 2005
Posts: 115
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


SCJP 1.4
Mahesh x Bogadi
Ranch Hand

Joined: Jul 06, 2004
Posts: 51
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.
Ravi Sathish
Ranch Hand

Joined: Feb 26, 2002
Posts: 131
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

Joined: May 05, 2005
Posts: 115
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
 
 
subject: Help needed for File Uploading code...
 
Similar Threads
drag and drop component based gui
drag and drop
Passed SCWCD 1.5
Good reporting plug-in for java.
drag and drop from awindows file manager