我写的上传例子:
Dim st_fujian_name As String
Dim st_filetype As String
Dim st_filename As String
Dim st_file As String
Dim st_path As String
Dim st_filepath As String
Dim save_file As String
Dim st_select As String Dim ll_i As Integer
Dim maxid As String
Dim ll_file As Double
Dim st_file_value As Integer
Dim bl_pd As Boolean = False
Dim fj_sum As Integer
Dim f_file As HttpPostedFile
Dim file_fj As HttpFileCollection = System.Web.HttpContext.Current.Request.Files
Dim data_file As String '保存到数据库中的文件路径
Dim st_r As Random '声明随机数
Dim st_name As String
f_file = file_fj(ll_i)
st_file_value = f_file.ContentLength
st_filetype = f_file.ContentType
st_filename = f_file.FileName
st_name = st_filename.Remove(0, st_filename.LastIndexOf("\") + 1)
st_file = st_filename.Remove(0, st_filename.LastIndexOf(".") + 1)
ll_file = f_file.ContentLength
Label4.Text = Now.Year.ToString + Now.Month.ToString + Now.Day.ToString
st_path = "." + st_file
save_file = Server.MapPath("userdata\" & "tertewt" & st_path)
bl_pd = Directory.Exists(Server.MapPath("userdata\" & st_filepath))
'不存在路径的话就创建文件夹
If bl_pd = False Then
Directory.CreateDirectory(Server.MapPath("userdata\" & st_filepath))
End If f_file.SaveAs(save_file)
Dim st_fujian_name As String
Dim st_filetype As String
Dim st_filename As String
Dim st_file As String
Dim st_path As String
Dim st_filepath As String
Dim save_file As String
Dim st_select As String Dim ll_i As Integer
Dim maxid As String
Dim ll_file As Double
Dim st_file_value As Integer
Dim bl_pd As Boolean = False
Dim fj_sum As Integer
Dim f_file As HttpPostedFile
Dim file_fj As HttpFileCollection = System.Web.HttpContext.Current.Request.Files
Dim data_file As String '保存到数据库中的文件路径
Dim st_r As Random '声明随机数
Dim st_name As String
f_file = file_fj(ll_i)
st_file_value = f_file.ContentLength
st_filetype = f_file.ContentType
st_filename = f_file.FileName
st_name = st_filename.Remove(0, st_filename.LastIndexOf("\") + 1)
st_file = st_filename.Remove(0, st_filename.LastIndexOf(".") + 1)
ll_file = f_file.ContentLength
Label4.Text = Now.Year.ToString + Now.Month.ToString + Now.Day.ToString
st_path = "." + st_file
save_file = Server.MapPath("userdata\" & "tertewt" & st_path)
bl_pd = Directory.Exists(Server.MapPath("userdata\" & st_filepath))
'不存在路径的话就创建文件夹
If bl_pd = False Then
Directory.CreateDirectory(Server.MapPath("userdata\" & st_filepath))
End If f_file.SaveAs(save_file)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货