473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

dynamic upload

is it possible to set the filename of an HttpInputFile control from code
someplace? I need to be able to take a file path sent by the user in the
address bar like http://www.randomeplace.com/xml/defa...mlFile=*insert path
here* and have it post to the system to i can call a button click even to
upload it to my server and put it into a db. i think i have the last parts
of the code figured out, but i cannot seem to set the value of the InputFile.
any ideas or suggestions would be much appreciated

thanks
john
Nov 19 '05 #1
3 941
Hi John,

I'm afraid not. The value property of a File input HTML element cannot be
set programmtically. This is for security reasons. Otherwise, dishonest
developers could heist any files they wanted from the user's machine.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"John" <Jo**@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
is it possible to set the filename of an HttpInputFile control from code
someplace? I need to be able to take a file path sent by the user in the
address bar like http://www.randomeplace.com/xml/defa...mlFile=*insert
path
here* and have it post to the system to i can call a button click even to
upload it to my server and put it into a db. i think i have the last
parts
of the code figured out, but i cannot seem to set the value of the
InputFile.
any ideas or suggestions would be much appreciated

thanks
john

Nov 19 '05 #2
i guessed as much..now i'm trying to use webclient upload but i'm getting an
"Object reference not set to an instance of an object" error.
private void Page_Load(object sender, System.EventArgs e)
{
WebClient wb=new WebClient();
string fileName="C:\\MainApp-DEV\\uploads\\UploadedFile.xml";

Trace.Write("before not postback",Request.RequestType.ToString());

wb.UploadFile(fileName,"POST",Request.Params["xmlFile"].ToString());

}

is what i'm using to try this. i already have code that can upload files,
but with this app i cant have user input like them browsing for the file or
typing it in or clicking a button. it all has to be done automatically when
they go to the page and provide the file path in the xmlFile parameter. i'd
appreciate any help on the matter and dont worry about telling me its all
wrong and here's how to do it or anything like that.

thanks
john
Nov 19 '05 #3
John,

It can't be done. If it could, Microsoft and everyone else would put out
Service Packs to prevent it!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.

"John" <Jo**@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
i guessed as much..now i'm trying to use webclient upload but i'm getting
an
"Object reference not set to an instance of an object" error.
private void Page_Load(object sender, System.EventArgs e)
{
WebClient wb=new WebClient();
string fileName="C:\\MainApp-DEV\\uploads\\UploadedFile.xml";

Trace.Write("before not postback",Request.RequestType.ToString());

wb.UploadFile(fileName,"POST",Request.Params["xmlFile"].ToString());

}

is what i'm using to try this. i already have code that can upload files,
but with this app i cant have user input like them browsing for the file
or
typing it in or clicking a button. it all has to be done automatically
when
they go to the page and provide the file path in the xmlFile parameter.
i'd
appreciate any help on the matter and dont worry about telling me its all
wrong and here's how to do it or anything like that.

thanks
john

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: hsomob1999 | last post by:
so i have a <ul> and I allow the user to append items to it. The problem is that on mozilla the <span class="line"> which is just a line to divide the sections gets overlaped and doesnt move down...
7
by: JavaScriptRocks | last post by:
I've been trying to imitate / reverse engineer the add attachment feature in gmail composer. I managed to do it to say about 80% but its giving me trouble in IE on WinXP-Sp2. I am using PHP to do...
3
by: IRAS Blues | last post by:
Hi all, I've got a form that consists of a bunch of textboxes and also file upload inputs. For both sets of fields, I need to be able to add in additional elements on the fly. This is done by an...
5
by: drdave | last post by:
Hi, I have 6 forms being generated using coldFusion, they are named special1, special2 special3 and so on.. in these forms I have a link to open a new window. I am trying to pickup the...
0
by: Jason | last post by:
Hi I wanted to bounce an Idea off you guys. I'm not sure if it's possible or even how to implement it .. or possibly if I'm trying to re-invent the wheel. Our users currently use excel and a...
1
by: 4wheelinwilly | last post by:
I am somewhat new to PHP, but really like it so far. I have created a database (MySQL) and upload/edit pages enabling the user to upload photos and descriptions. Outputing them in a gallery format...
4
by: redoranda | last post by:
hi im a new user here. apparently im working on a project that is creating a dynamic form. Assume user can insert the data into text field and upload csv file, csv file may have two columns. user has...
0
by: pinxi | last post by:
We are seeking to hire a lead programmer to build a dynamic Web-based imaging module which will enable users to upload a digital image or photograph to the site and choose from thousands of...
6
by: sathyashrayan | last post by:
Dear Group, Please look at the following demo link. http://www.itsravi.com/demo/new_pms/admin/addproject.php
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.