.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Music file upload in asp.net

Posted By: chandru     Posted Date: April 19, 2011    Points:5   Category :ASP.Net
hi, friends

i have used in this code. but this support to local. not support to FTP server side pls help this

cs coding:

protected void Button1_Click(object sender, EventArgs e)
SqlConnection con = new SqlConnection(strCS);
SqlCommand cmd = new SqlCommand("Sp_Audio", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@song", FileUpload1.FileName);


if (FileUpload1.HasFile)

string fname = FileUpload1.FileName.ToString();

string folderpath = "Audio";

string path = HttpContext.Current.Server.MapPath(folderpath);

FileUpload1.PostedFile.SaveAs(path + "\\" + fname);

Response.Write("file upload sucessfully");


design code:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td></tr>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /></td></tr>

server error: the connection was reset this error displayed in http:\\

Author: Sunil Yadav       [Moderator]      
Posted Date: May 27, 2011     Points: 20   


Try setting the maxRequestLength and executionTimeout in your web.config.

<httpRuntime maxRequestLength="1048576" executionTimeout="3600"/>

Also the above code is vulnerable to File upload vulnerability.
This allows an attacker to upload malicious files.
You can refer this link https://www.owasp.org/index.php/Unrestricted_File_Upload

Hope this helps.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend