FileUpload 好像有问题啊。。。。。。。。。。。
Dim line as string = " "
while(true)
line + = New StreamReader(FileUpload .FileContent).ReadLine
If (IsNothing(Line)) Then
Exit While
End If
End While
‘然后我获得了一个line字符串啊。因为我需要用这个字符串啊。
‘接着我存储这个文件的时候。这个文件总是空啊是不是FileUpload 有问题啊?
Dim path as String= "xxxxxxxx "
FileUpload.SaveAs(path)
------解决方案--------------------这个文件总是空啊是不是FileUpload 有问题啊
========>
可跟踪一下,看有没有上传文件.用streamreader读取不会影响这个文件.
------解决方案--------------------FileUpload 没有任何问题。你的使用方法有问题、
------解决方案--------------------Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim line As String = " "
Dim sum As String = " "
Dim sr As New StreamReader(FileUpload1.FileContent)
While (True)
line = sr.ReadLine
If (IsNothing(line)) Then
Exit While
sr.Dispose()
Else
sum += line
End If
End While
Dim bFlag As Boolean = sum.IndexOf( "xxxxxx ") < 0
If (Not bFlag) Then
FileUpload1.SaveAs(Server.MapPath( "~/upload/ ") & System.IO.Path.GetFileName(FileUpload1.FileName))
Else
Response.Write( "没有找到 ")
End If
End Sub
------解决方案--------------------逻辑不对~