Results 1 to 2 of 2
- 03-21-2011, 02:49 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 5
- Rep Power
- 0
Automatically upload file to FTP server
Hi everyone, :confused:
i'm making an investigation about uploading files to FTP server, i googled about it and found the next sample code:
My question is: how can i automatically upload every file in certain directory, such as C:\upload. Everytime that i put a new file in that directory it should be uploaded.Java Code:import org.apache.commons.net.ftp.FTPClient; import java.io.FileInputStream; import java.io.IOException; public class FileUploadDemo { public static void main(String[] args) { FTPClient client = new FTPClient(); FileInputStream fis = null; try { client.connect("ftp.domain.com"); client.login("admin", "secret"); // // Create an InputStream of the file to be uploaded // String filename = "Touch.dat"; fis = new FileInputStream(filename); // // Store file to server // client.storeFile(filename, fis); client.logout(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (fis != null) { fis.close(); } client.disconnect(); } catch (IOException e) { e.printStackTrace(); } } } }
Thanks for your help! :D
- 03-21-2011, 03:48 PM #2
Member
- Join Date
- Mar 2011
- Location
- Bulacan, Philippines
- Posts
- 23
- Rep Power
- 0
Similar Threads
-
Upload/download a file to/from server
By karq in forum NetworkingReplies: 16Last Post: 08-24-2010, 09:43 AM -
Upload war file on server
By sandeeprao.techno in forum Advanced JavaReplies: 2Last Post: 12-16-2009, 10:55 AM -
:large file upload to server(chunk upload)
By tommy_725 in forum NetworkingReplies: 0Last Post: 10-16-2009, 12:21 AM -
UPload a file to server?
By makpandian in forum JavaServer Pages (JSP) and JSTLReplies: 10Last Post: 07-21-2009, 01:35 PM -
Automatically File Upload to server ...Help Needed
By 82rathi.angara in forum New To JavaReplies: 6Last Post: 08-05-2008, 07:13 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks