Have this upload script, and it works. But I would like to add a cmd command after the upload has complete. Is this possible? Thank you in advance.
<%@ Page Language=VBScript %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs("C:\Inetpub\wwwroot\upload\" & _
FileUpload1.FileName)
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If
End Sub
</script>
Use ProcessStartInfo:
C#
VB:
To use it in your example:
Put the function outside of your sub (like right above it) and put the following line where you’d like the code to execute.
ExecuteCommand(“REN C:\Document.rtf YES.rtf”,100)
You can check the return value (0 for success) to see if it was successful.
To do without using the command line:
Change your line that saves to file to the following: