Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Ajax Uploader
»
Re: Upload photos should not upload any file with 0 bytes or show a proper warning message
Upload photos should not upload any file with 0 bytes or show a proper warning message
Last post 04-28-2009, 12:04 AM by
Shaitender
. 2 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
04-21-2009, 11:47 PM
51344
Shaitender
Joined on 04-13-2009
Posts 12
Upload photos should not upload any file with 0 bytes or show a proper warning message
Reply
Quote
Hello guys
i wanted to restrict user to Upload photos should not upload any file with 0 bytes or show a proper warning message
Can you tell me how can i restrict that ...Help needed urgently !!!
Thanks
04-23-2009, 9:16 AM
51430
in reply to
51344
cutechat
Joined on 07-22-2004
Posts 2,332
Re: Upload photos should not upload any file with 0 bytes or show a proper warning message
Reply
Quote
Hi,
Here is an example for you :
<
%@ Page
Language
=
"C#"
Title
=
"First sample"
%
>
<
%@ Import
Namespace
=
"CuteWebUI"
%
>
<
%@ Register
TagPrefix
=
"CuteWebUI"
Namespace
=
"CuteWebUI"
Assembly
=
"CuteWebUI.AjaxUploader"
%
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
>
<
script
runat
=
"server"
>
void InsertMsg(string msg)
{
ListBoxEvents.Items.Insert(0, msg);
ListBoxEvents.SelectedIndex
=
0
;
}
protected void UploadAttachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)
{
InsertMsg("Added.." + args.Item.FileName);
}
protected void UploadAttachments1_FileValidating(object sender, UploaderEventArgs args)
{
if (
args.FileSize
== 0)
{
throw (new Exception("Please do not upload empty file !"));
}
}
</
script
>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
</
head
>
<
body
>
<
form
id
=
"Form1"
runat
=
"server"
>
<
CuteWebUI:UploadAttachments
runat
=
"server"
ID
=
"UploadAttachments1"
OnAttachmentAdded
=
"UploadAttachments1_AttachmentAdded"
OnFileValidating
=
"UploadAttachments1_FileValidating"
>
</
CuteWebUI:UploadAttachments
>
<
br
/>
<
div
>
Server Trace:
<
br
/>
<
asp:ListBox
runat
=
"server"
ID
=
"ListBoxEvents"
Width
=
"800"
>
</
asp:ListBox
>
</
div
>
</
form
>
</
body
>
</
html
>
Regards,
Terry
04-28-2009, 12:04 AM
51586
in reply to
51430
Shaitender
Joined on 04-13-2009
Posts 12
Re: Upload photos should not upload any file with 0 bytes or show a proper warning message
Reply
Quote
THanks ..Terry !!!
Thanks a lot !!!