Re: using html control to download file from client to server



The statement below seems to work so will just use it, thanks.
year= Request.Form("DropDownList1");
--
Paul G
Software engineer.


"Russell" wrote:

Make your selects into <asp:DropDownList runat=server or at least make
them runat=server.

Otherwise the data isn't available server-side except through the
Request or Request.Form hashes.

string val = Request.Form("year_dropdown");
if (val != null)
{ ...

DropDownList has a SelectedValue property.


Paul wrote:
Hi thanks for the additional information. I think I almost have it working
but am having syntax issues building the MyFile.PostedFile.SaveAs("c:\temp\"
& ...your logic to create the file based on your requirements) line. I am
trying to build the path dynamically and have 2 dropdown boxes but can not
seem to get the selected value from these to append the path in the line
MyFile.PostedFile.SaveAs(). For the dropdown year box I have
<select name="year_dropdown">
<option value="2007" selected>2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option></select></p>
so when the file is saved I want it to go to (c:\2007\filename) if 2007 is
selected for example. I am doing the same thing with the month that is
selected.
--
Paul G
Software engineer.


"Ameet Phadnis" wrote:

You have to do the following to make it work -
1. On the HTMLInputFile set the runat property to server.
2. Add another button called upload.
3. In Click event on the server side for upload write the following
functionality -
MyFile.PostedFile.SaveAs("c:\temp\" & ...your logic to create the file based
on your requirements)

Please let me know if the above helps.

--
Ameet Phadnis
Sr. Technical Consultant
e Tek Global Inc.


"Paul" wrote:

actually I am running the script on the server I think,
<script language="javascript" runat="server">
--
Paul G
Software engineer.


"Ameet Phadnis" wrote:

Are these Month and Year JScript variables.

Typically, you would write the upload function in your server side script.
All the processing of forming the path and file name needs to be done on the
server.

If you need syntax for that please let me know.

--
Ameet Phadnis
Sr. Technical Consultant
e Tek Global Inc.


"Paul" wrote:

Hi I am using the HtmlInputFile control to upload a file from a client to a
server. I have a browse to find the file on the server but need to create
the path dynamically as to were it will go based on some dropdown boxes, one
for the year and one for the month. This line saves the file so I am trying
to get the month and year from the dropdown boxes and put them in the month
and year variables but this does not work,
File1.PostedFile.SaveAs(("c:\\temp\\" + "\\" + month + "\\" + year +
Text1.Value))

These are the 2 lines I have to get the selected month and year but
var month=month_dropdrown.selectedindex;
var year=year_dropdrown.selectedindex;
but I get a compiler error, month_dropdown not defined. I am using
javascript.
I also tried printing out the variables using alert() but got a compiler
error, (not defined).
thanks
--
Paul G
Software engineer.


.