Anthony904
IS-IT--Management
I have a form that a user can browse and upload a file (excel) to the server. Once the the file is uploaded, the user hits a button that transfer the data into access.
My problem is .. The upload form currently displays the "transfer" button on startup. I would like for this to be displayed after the file has been uploaded.
Any Ideas? Thanks!
This is the upload sub...
This is where the button currently resides...
My problem is .. The upload form currently displays the "transfer" button on startup. I would like for this to be displayed after the file has been uploaded.
Any Ideas? Thanks!
This is the upload sub...
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
Dim c as string = System.IO.Path.GetFileName(strFileName) ' only the attched file name not its path
' 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."
catch Exp as exception
span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.visible = false
span2.visible=false
span3.visible=false
End Try
End Sub
Code:
<Body>
<Font Color="DarkGreen" Face=Helvetica Size=5> <B>Upload
</Font>
<HR Size="2" Color=Black >
<P>
<Form Method="Post" EncType="Multipart/Form-Data" RunAt="Server">
Choose Your File To Upload : <BR>
<Input ID="MyFile" Type="File" RunAt="Server" Size="40"> <BR>
<BR>
<Input Type="Submit" Value="Upload" OnServerclick="Upload_Click" RunAt="Server">
<Div ID="UploadDetails" Visible="False" RunAt="Server">
File Name: <Span ID="FileName" RunAt="Server"/> <BR>
File Content: <Span ID="FileContent" RunAt="Server"/>
<BR>
File Size: <Span ID="FileSize" RunAt="Server"/>bytes
<BR></Div>
<Span ID="Span1" Style="Color:Red" RunAt="Server"/>
<Span ID="Span2" Style="Color:Red" RunAt="Server"/>
<br><br><Span ID="Span3" Style="Color:Blue" RunAt="Server"/>
[COLOR=red]<Input Type="submit" Value="Transfer" OnServerclick="Signout_Click" RunAt="Server">[/color red]
</Form>
</Body>