Total members 11895 |It is currently Mon Dec 30, 2024 6:38 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





I have a requirement to upload excel data (from .aspx) to the SQL server. To do this I am implemented using SSIS. I have created SSIS package(deployed) and executing it using c#. When i am running the application it is working fine inserting data into the database.After this we just want to Upload file Dynamically using File Upload Control.Please Provide Coding For this Requirement




Author:

What i understood that you need to upload file (excel file ) using ASP.NET, following ASP.NET using visual basic. Following ASP.NET 2 :
Code:
<%@ Page Language="VB" %>

<
script runat="server">
    Protected 
Sub FunUploadFile(ByVal sender As Object_
      ByVal e 
As System.EventArgs)
        If 
UploadParam.HasFile Then
            
Try
                
UploadParam.SaveAs("C:\Temp\" & _
                   UploadParam.FileName)
                msgLabel.Text = "
Name" & _
                   UploadParam.PostedFile.FileName & "
<br>" & _
                   " 
Size" & _
                   UploadParam.PostedFile.ContentLength & " 
kb<br>" & _
                   "
Content type" & _
                   UploadParam.PostedFile.ContentType
            Catch ex As Exception
                msgLabel.Text = "
err" & ex.Message.ToString()
            End Try
        Else
            msgLabel.Text = " 
No file specified...."
        End If
    End Sub
</script>

<html >
<head runat="
server">
    <title>Upload Files</title>
</head>
<body>
    <form id="
myForm" runat="server">
    <div>
        <asp:FileUpload ID="
UploadParam" runat="server" /><br />
        <br />
        <asp:Button ID="
Button1" runat="server" OnClick="FunUploadFile
         Text="
Upload File" />&nbsp;<br />
        <br />
        <asp:Label ID="
msgLabel" runat="server"></asp:Label></div>
    </form>
</body>
</html>

and this generate html code as :
Code:
<html >
<
head><title>
   
Upload Files
</title></head>
<
body>
    <
form name="myForm" method="post" action="fileUpload.aspx" 
     
id="myForm" enctype="multipart/form-data">
<
div>
<
input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="Genereted Value" />
</
div>

    <
div>
        <
input type="file" name="UploadParam" id="UploadParam" /><br />
        <
br />
        <
input type="submit" name="Button1" value="Upload File" 
         
id="Button1" />&nbsp;<br />
        <
br />
        <
span id="Label1"></span>
    </
div>
    
<
div>

   <
input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" 
    
value="Genereted Value" />
</
div></form>
</
body>
</
html>
 

When this code run, the user select a file to upload, as you notice that the destination folder is determined at the ASP code. Please note that the destination folder writing permissions should be set correctly. You may notice that “FileUpload” control element in VB was converted to <input type…> HTML element.

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Uplading Files Dynamically Using SSIS
 connect SSIS package with ASP.net     -  
 SSIS .dtsx packages and .net     -  
 Dynamically Create Image     -  
 Calling Functions Dynamically     -  
 Add new row dynamically to table using JQuery     -  
 invoke class method dynamically in php     -  
 Add and Remove CSS classes to html tag dynamically     -  
 Dynamically Setting and Accessing Variables     -  
 change link <a> attributes dynamically     -  
 How To Store Date Dynamically as a field in mysql using JSP     -  



Topic Tags

ASP Files and I/O






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com