Anthony904
IS-IT--Management
Hi,
I have some code that uploads a file (excel) to our server (asp.net)..
I have another page that takes that file and imports it into access (asp)
The question I have is.. is there a way I can pass that C variable into my asp file?
Thanks!
I have some code that uploads a file (excel) to our server (asp.net)..
Code:
Sub Upload_Click(Sender as Object, e as EventArgs)
' Display properties of the uploaded file
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
UploadDetails.visible = True
' Let us recover only the file name from its fully qualified path at client
Dim strFileName as string
strFileName = MyFile.PostedFile.FileName
[COLOR=red]Dim c as string = System.IO.Path.GetFileName(strFileName) ' only the attched file name not its path[/color]
' Let us Save uploaded file to server at C:\ServerFolder\
Try
MyFile.PostedFile.SaveAs("C:\ServerFolder\" + c)
Span1.InnerHtml = "Your File Uploaded Sucessfully as: ..C:\ServerFolder\" & c
Span3.InnerHtml = "Thank you! Click TRANSFER to import to access. "
BtnTransfer.visible=true
catch Exp as exception
span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.visible = false
span2.visible=false
span3.visible=false
BtnTransfer.visible=false
End Try
End Sub
I have another page that takes that file and imports it into access (asp)
Code:
Dim cnnExcel, rstExcel
Dim cnnAccess, rstAccess
Dim strExcelFile
Dim strAccessFile
strExcelFile = Server.MapPath(".") & "\Server\" & [COLOR=red]"ExcelExportData.xls"[/color]
strAccessFile = Server.MapPath(".") & "\ImportData.mdb"
Thanks!