HTTP File Upload without User Interaction using .NET - CAB File
(Page 4 of 4 )
8. In order for the control to be downloaded over the Internet, we need to package it into CAB file. This can be done with the help of "Package and Deployment Wizard" provided Visual Studio6.
9. The wizard would generate a CAB file and htm file. Copy these 2 files to your webserver's virtual directory and write a small javascript function in the htm file which would call the control's uploadFile method. Eg
<script language=javascript>
function upload()
{
var b,errno,errdesc,errsrc;
FileUploadCtrl.uploadFile("http://localhost/Myupload/upload.aspx", "c:\\uploads\\uploadFile.doc",errno);
}
</script>
10. The one thing that you have to keep in mind is you need to sign the activex control for it to be installed on the client machine without changing the security settings of Internet Explorer.
If you are planning to give an uninstalled activex control then on the client machine' Internet Explorer, you've got to go to internet options->security->internet and reduce it to the lowest level.
Conclusion
In this article, we have seen how to write our own custom code to upload a file over the Internet. And I hope I have answered the questions of many people who have queried me on how to write the upload control.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |