I am using ASP.net 4.5 with VB.net
This is my TestPage.aspx code
<%@ Page Language="VB" MasterPageFile="~/Master.master" AutoEventWireup="false" CodeFile="TestPage.aspx.vb" Inherits="TestPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMaster" runat="Server">
<form role="form" method="post" id="Test_form" action="TestPageLOAD.aspx"
<div class="form-group">
<input class="form-control" type="text" id="headline" name="headline" />
</div>
<div class="form-group">
<div class="fileUpload btn btn-default">
<span>Upload article image</span>
<input type='file' id="imgInp" name="imgInp" class="upload" />
</div>
</div>
<button type="submit" name="submitReport" id="submitReport">SUBMIT REPORT</button>
</form>
</asp:Content>
This is my TestPageLOAD.aspx.vb code on Page_Load Event
Dim nvc As NameValueCollection = Request.Form()
lblHeadline.text = nvc("headline")
Dim MyFileToUpload As String
MyFileToUpload = nvc("imgInp")
Dim FolderPath As String
Dim FolderPathDOC As String
FolderPath = "~/pics/"
If MyFileToUpload.HasFile Then
Dim strFileName As String
Dim Extention As String = System.IO.Path.GetFileName(MyFileToUpload.PostedFile.FileName)
Dim NoExtention As String = System.IO.Path.GetFileNameWithoutExtension(MyFileToUpload.PostedFile.FileName)
strFileName = NoExtention + "_logo" + Extention.Substring(Extention.LastIndexOf("."))
Dim filePath As [String] = Server.MapPath(FolderPath & strFileName)
MyFileToUpload.SaveAs(filePath)
End If
Now this code works fine populating or saving the data on the TestPageLOAD.aspx.vb, but I cant upload the image on this LOAD page. Is there a way around it? I do not want to change the controls to ASP.net controls on the TestPage.aspx as it needs to stay plain HTML. But now uploading the image is now my problem.....
VB.net or C# code will be fine