Invoke a remote button on a web page

S

shantanu

Dear All
I have a very urgent requirement if somebody can
help!!!!!!!!!!!!!!!!!!!!!!

i have a requirement to upload a file through a remote web page.
Speaking more clearly i have a excel addin that will pick some values
from the cells and create a text file, after that using a web page url
it will try to uplaod that text file. The Webpage consists of a File
control and a Button to Import. Now the above process will be silent
and will be not visible to the user. I have tried with the querystring
using the POST meathod of httpWebRequest, but the querystring does not
provide any facility to specify the file location.

Kindly help
Thanx
shantanu
 
J

Jeff Hopper

Shantanu,

You've mentioned an Excel addin and a web page, but it's not clear where you
need to initiate the upload. If you need to upload the file from Excel via a
URL, then what is the purpose of the controls on the web page? Can you
clarify exactly what you need help with, where you would like this code to
be, etc?

Thanks,
Jeff
 
P

Patrice

Try :
http://msdn2.microsoft.com/en-us/library/system.net.webclient.uploadfile(VS.80).aspx
to create an HTTP query that will post the file to a server side page.

Server side you never have access to client side files. So when you upload a
file, the browser uses the location entered by the user and sends the file
content to the server as part of the resquest. This is what this method
does.

It should allow to directly post. If you wanted to still ask for
confirmation you can't this way (an input type=file tag is not writable for
safety reason, else a site could write the file location and grab files
without asking to users).

Also I would likely do a specif page for non ui post (for example to avoid
having possible problme with viewstates). You can get the file server side
by using Request.Files even if you don't have a control on the page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top