views:

21

answers:

0

In linux machine,Using cURL, I'm trying to upload a text file to a asp.net site. I'm new to cURL.

My Source code...

Upload.aspx

<%@ Page Language="C#" AutoEventWireUp="false" CodeFile="Upload.aspx.cs" Inherits="Upload" EnableViewStateMac="false" EnableSessionState="false" EnableViewState="false" %>
<html>
  <head>  </head>
    <body>
<form id="form1" method="post" runat="server">
   <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="btnUpload" runat="server" Text="Upload" onclick="btnUpload_Click" />
</form>
    </body>
</html>

Upload.aspx.cs

Protected void btnUpload_Click(object sender,EventArgs e)
{
  string strSource= server.Mappath("~") + @"\UploadFiles\" + FileUpload1.FileName;
  FileUpload1.SaveAs(strSource);
}

From Linux machine I'm trying to execute....

curl -F [email protected] -F btnUpload=Upload http://webhost/upload.aspx

Output

returns something similar to the viewsource of the upload.aspx file..

Please help me out.

Anand.