请问自制FPT文件上传前重命名功能实现
Dim dlg As new OpenFileDialog
dlg.Filter= "JPEG 图像|*.jpg" '设置筛选器
If dlg.ShowDialog = DialogResult.OK Then
Dim xg As Integer = dlg.FileName.LastIndexOf("\")
Dim fname As String = dlg.FileName.SubString(xg + 1)
Dim ftp As new FTPClient '先定义好ftp的账号密码
Dim str As DataRow = DataTables("系统").DataRows(0) '在这个表设置ftp连接信息
ftp.Host = str("FTP_IP")
ftp.Account = str("FTP_Account")
ftp.Password = str("FTP_Password")
Dim dr As Row = Tables("表A").Current
Dim fp As String = "\Invoice\" & dr("发生日期").year & "\" & dr("登记者") & "\" & dr("发生日期").Month & "月份" '定义变量,来代替动态路径
Dim s As String = FileSys.RenameFile(fname,dr("_Identify") & ".jpg") ‘这段代码出错了,请老师帮助修改,感谢
If ftp.Upload(dlg.FileName,fp & "\" & s,True) = True Then '若成功上传
Tables("表A").Current("附件") = s
End If
end if
[此贴子已经被作者于2015/11/27 8:35:32编辑过]