How to set trigger in auto fileupload in asp.net

Description:-

In this article we will create auto FileUpload with using trigger control if we want to use trigger we can use without trigger we already check how to Auto upload file in dot net. Here we will Create Trigger for Upload file in our database.

Default.aspx:-
Drag File-upload Control in your Webpage.
Here I have used Uplodify JQuery for Auto Upload Files. You can Download Uplodify JQuery from Web. 

JQuery:-

<link rel="Stylesheet" type="text/css" href="CSS/uploadify.css" />
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/jquery.uploadify.js"></script>

Now Create Script for Auto Upload and Set Trigger for StartUplaod and for Cancel Queue Process.

<a href="javascript:$('#<%=FileUpload1.ClientID%>').fileUploadStart()">Start Upload</a>&nbsp;
    |&nbsp;<a href="javascript:$('#<%=FileUpload1.ClientID%>').fileUploadClearQueue()">Clear</a>

JavaScript:-
Now Create Script for Auto Upload file in your Folder.

<script type="text/javascript">
    $(window).load(
    function () {
        $("#<%=FileUpload1.ClientID%>").fileUpload({
            'uploader': 'scripts/uploader.swf',
            'cancelImg': 'images/cancel.png',
            'buttonText': 'Browse Files',
            'script': 'Upload.ashx',
            'folder': 'Files',
            'fileDesc': 'Image Files',
            'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
            'multi': true,
            'auto': false
        });
    }
);
</script>

Now run your Application and select files for upload and it will holds your file for upload by clicking on Start-upload it will Start-upload your files.

Related Posts

Previous
Next Post »

Thanks for comments.....