Parameters are obtained through the database.
String ftpfilename = filename;
If (file! = NULL)
{// Start File Upload
String ftphost = tsysconfigobj. getinstance (). getprovalue (
"File_upload_ftp_host ");
Int ftpport = 21;
String ftppartstring = tsysconfigobj. getinstance (). getprovalue (
"File_upload_ftp_port ");
If (stringutils. isnotblank (ftppartstring ))
{
Ftpport = integer. parseint (ftppartstring );
}
String ftpuser = tsysconfigobj. getinstance (). getprovalue (
"File_upload_ftp_username ");
String ftppasswd = tsysconfigobj. getinstance (). getprovalue (
"File_upload_ftp_password ");
String ftprootpath = tsysconfigobj. getinstance (). getprovalue (
"File_upload_ftp_path ");
Ftputils FTP = new ftputils (ftphost, ftpport, ftpuser, ftppasswd );
String remotepath = ftprootpath + type;
This. setfilename (ftpfilename );
Inputstream is = NULL;
Try
{
Is = new fileinputstream (File );
FTP. uploadfile (remotepath, is, ftpfilename );
}
Catch (filenotfoundexception E)
{
E. printstacktrace ();
}
Catch (exception E)
{
E. printstacktrace ();
}
Finally
{
If (is! = NULL)
{
Try
{
Is. Close ();
FTP. closeserver ();
}
Catch (ioexception E)
{
E. printstacktrace ();
}
}
}
} // End the Upload File
Return "loadpage ";