Click here to Skip to main content
15,888,239 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am looking for a way to use VB.Net to upload several files through an existing web-form. I do not have access to the actual server so I cannot do it that way. I know how to get the File Upload HTML element and Submit the form; however, I do not know how to set the file I wish to upload.

I have tried extensive Googling on this topic, but all I get is "How to set up a batch uploader with ASP.Net"

Any help would be appreciated, even though I will probably be smacking myself on the forehead later ;-)
Ethan
Posted
Comments
Sridhar Patnayak 3-Feb-12 2:29am    
So finally what you want, you cant access server, so where you want to upload
Matchlighter 3-Feb-12 2:54am    
I should have said that I don't have full access to the server to change the script so it supports batch uploads. I do have access to the upload form, which looks like this: http://bit.ly/xvGg7o
[no name] 3-Feb-12 4:03am    
Hi,

Basically you'd be needing just the file name to enter on the FileUpload Textbox. How about storing the filename in a persistant file and pasting it programmatically on the WebForm's textbox?
Matchlighter 3-Feb-12 14:33pm    
I know where the file is, but I don't know how to set the File 'Element' in the webform to it. Is there an attribute I can set or something similar?
Sergey Alexandrovich Kryukov 3-Feb-12 4:11am    
Maybe I did not understand the question but "I do not have access to the actual server" make all the further talking useless. If you question makes some sense, don't hesitate to explain it to us.
--SA

1 solution

Hi,

You can try this javascript idea:

JavaScript
function funcAutofillUploadForm() {
            var uploadctrl = document.getElementById('MainContent_fuControl');
            var inputCtrl = uploadctrl.outerHTML;            
        }


Now, inputCtrl would hold something like:

HTML
<INPUT id=MainContent_fuControl type=file value=ertterth name=ctl00$MainContent$fuControl>


You just have to find a way to replace the value part with your path.
 
Share this answer
 
Comments
Matchlighter 6-Feb-12 13:20pm    
VB.Net has similar DOM functions, so I know how to get that far. However, The input type 'file' does not use the value attribute, as noted here http://www.w3schools.com/tags/att_input_value.asp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900