Reputation: 1683
I don't really know how to explain what I want to do.
I will try to explain what I am doing. I built a website in ASP.NET 4 (WebForms) and I want that my brother will be able to click on a button, choose a file from his computer and it will be uploaded to my server.
I have no idea how to do it. It sounds very hard to do and I am really stuck with this for a few days now.
I don't care if it will be with JavaScript, HTML or C#, I just really need it to work.
Upvotes: 0
Views: 300
Reputation: 561
you have 2 options really.. use a traditional fileupload control (from the toolbox) or use the Ajax AsyncFileupload control. either way it will allow your brother to upload a file from his computer to your server.
Upvotes: 0
Reputation: 218798
There's an ASP.NET control made just for that, the FileUpload
control. Here's a handy example.
Note that it's notoriously difficult to style if you want to apply CSS and make it elegant, but there are more advanced ways around that. Also, this won't give your web application access to the client's local files or anything like that, it's just a standard file open dialog box for the user to select a file and upload it.
I also highly recommend doing a lot of input checking when accepting files. File type, file size, etc. are all important.
Upvotes: 2