J
JenHu
Hi experts,
I want to create a new empty text file after I upload a file to
the desination. Then I need to read each line from the uploaded file
and write the lines which first character <>'6' to the new
file.
Can someone show me how to do this? First of all, what is the syntax
to create a new text file? Thank you.
This is the funcation for upload file:
-----------------------------------------------------------------
Sub Upload_Click(ByVal source As Object, ByVal e As EventArgs)
Dim savePath As String = "C:\temp\"
Dim postedFile = uploadedFile.PostedFile
Dim filename As String =
Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
'upload file to destination directory
postedFile.SaveAs(savePath & filename)
message.Text = postedFile.Filename & " uploaded"
& _
"<br>content type: " & contentType &
_
"<br>content length: " &
contentLength.ToString()
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
'Create a new text file
End Sub
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
I want to create a new empty text file after I upload a file to
the desination. Then I need to read each line from the uploaded file
and write the lines which first character <>'6' to the new
file.
Can someone show me how to do this? First of all, what is the syntax
to create a new text file? Thank you.
This is the funcation for upload file:
-----------------------------------------------------------------
Sub Upload_Click(ByVal source As Object, ByVal e As EventArgs)
Dim savePath As String = "C:\temp\"
Dim postedFile = uploadedFile.PostedFile
Dim filename As String =
Path.GetFileName(postedFile.FileName)
Dim contentType As String = postedFile.ContentType
Dim contentLength As Integer = postedFile.ContentLength
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
'upload file to destination directory
postedFile.SaveAs(savePath & filename)
message.Text = postedFile.Filename & " uploaded"
& _
"<br>content type: " & contentType &
_
"<br>content length: " &
contentLength.ToString()
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
'Create a new text file
End Sub
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*