HI,

I am very new here in the forum, and I usually try to find myself the problems before to cry for help, but I really cannot see what is wrong.

I have a C# script to upload a picture, and it is working fine. The case is that this script should receive a couple POST vars from the previous script, and it is not working. I am receiving a compilation error, and I believe that the problem is the place in the script where I am trying to retrieve the vars. I have made them public but it is still not working. Could you help please?

The script:

Code:
<%@ Import Namespace="System.Data.SqlClient" %>

<% @Page Language="C#" %>

<html>
<head>
	<title>File upload in ASP.NET</title>
</head>
<body bgcolor="#ffffff" style="font:8pt verdana;">

<script language="C#" runat="server">

public string carmake = Request["car_make"];
public string carmodel = Request["car_model"];
public string caryear = Request["car_year"];
public string wrecktype = Request["wreck_type"];

void btnUploadTheFile_Click(object Source, EventArgs evArgs) 
{
	string strFileNameOnServer = txtServername.Value;
	string strBaseLocation = "c:\\ASPDNSFWithPL2\\Web\\games\\wrecking\\pics\\";

	if ("" == strFileNameOnServer) 
	{
		txtOutput.InnerHtml = "Error - a file name must be specified.";
		return;
	}

	if (null != uplTheFile.PostedFile) 
	{
		try 
		{
			uplTheFile.PostedFile.SaveAs(strBaseLocation+strFileNameOnServer);
			
			String SqlQuery = "INSERT INTO GameWreckingGuess (car_pic,car_year,car_make,car_model,wreck_type) values ('" + strFileNameOnServer + "','" + caryear + "','" + carmake + "','" + carmodel + "','" + wrecktype + "')";
			SqlConnection myConn = new SqlConnection("data source=*******;initial catalog=*********;user id=****;password=********;persist security info=True;packet size=4096");
			SqlCommand myCommand = new SqlCommand(SqlQuery, myConn);
			myCommand.Connection.Open();
			myCommand.ExecuteNonQuery();
			
			txtOutput.InnerHtml = "<meta http-equiv=\"refresh\" content=\"3;url=games_wrecking_wizard_3.aspx\" />";
			
		}
		catch (Exception e) 
		{
			txtOutput.InnerHtml = "Error saving <b>" + 
				strBaseLocation+strFileNameOnServer+"</b><br>"+ e.ToString();
		}
	}
}

</script>

<table width="690" height="440" border="0">
  <tr><td valign="top"><img src="/images/games_cpanel.jpg" /></td></tr>
  <tr>
    <td>
    	WRECKING GAME - New Game Wizard<br /><br />
    	Step 2/3: Choose the car picture <br /><br />
	<form enctype="multipart/form-data" runat="server">
	<tr>
	  <td>Select file:</td>
	  <td><input id="uplTheFile" type=file runat="server"></td>
	</tr>
	<tr>
	  <td>Name on server:</td>
	  <td><input id="txtServername" type="text" runat="server"></td>
	</tr>
	<tr>
	  <td colspan="2">
	  <input type=button id="btnUploadTheFile" value="Upload and proceed to next step &gt;&gt;" 
	   OnServerClick="btnUploadTheFile_Click" runat="server">
	  </td>
	</tr>
	</form>
</table>
    
<span id=txtOutput style="font: 8pt verdana;" runat="server" />

</body>
</html>
Thanks!