|
hi friend ,
I am uploading file using asp.net file control .how will i check filesize in client side before upload.
pls if u can send me code for it .
It should work on both browser IE & mozilla
pls it is urgent
thanks in advance
|
|
|
|
|
kuwl_mark wrote: pls it is urgent
How unusual...
This[^] was the first hit I got by googling 'javascript file size'.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
but this will not work in mozilla also I have to change your browser settings to run this code
|
|
|
|
|
Yes, exactly.
The thread that Christian linked to gives you the correct answer to your question.
---
single minded; short sighted; long gone;
|
|
|
|
|
I hope it helps : i found something in some search engines and i suggest you to search before open an message to forums because you can find answers more quickly..
check them out : http://www.jguru.com/faq/view.jsp?EID=330134[^]
function getStats(fName){
nullIMG.src = fName;
fullName = fName;
shortName = fullName.match(/[^\/\\]+$/);
splitName = fullName.split(".");
fileType = splitName[1];
fileType = fileType.toLowerCase();
if (fileType == 'gif' || fileType == 'jpg' || fileType == 'jpeg')
{
checkIt = fileSize(fullName);
if (parseInt(checkIt) > 30000){alert('Max File Size is 30Kb');Form1.reset()}
else {
Form1.dispSize.value = checkIt;
Form1.dispName.value = shortName;
Form1.dispW.value = nullIMG.width;
Form1.dispH.value = nullIMG.height;
}
}
else {
alert("You must select an image file!");
Form1.reset();
}
}
divStr = "<Div Style='Position:Absolute;Top:-2000'><IMG Src=Null ID=nullIMG></Div>"
document.write(divStr)
Function fileSize(fileSpec)
Dim isSize
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.GetFile(fileSpec)
isSize = contentFile.Size
fileSize = isSize
Set contentFile = Nothing
Set fso = Nothing
End Function
Choose an image:
File Name:
File Size:
Width:
Height:
|
|
|
|
|
http://www.jguru.com/faq/view.jsp?EID=330134[^]
and check that code mentioned below out
function getStats(fName){
nullIMG.src = fName;
fullName = fName;
shortName = fullName.match(/[^\/\\]+$/);
splitName = fullName.split(".");
fileType = splitName[1];
fileType = fileType.toLowerCase();
if (fileType == 'gif' || fileType == 'jpg' || fileType == 'jpeg')
{
checkIt = fileSize(fullName);
if (parseInt(checkIt) > 30000){alert('Max File Size is 30Kb');Form1.reset()}
else {
Form1.dispSize.value = checkIt;
Form1.dispName.value = shortName;
Form1.dispW.value = nullIMG.width;
Form1.dispH.value = nullIMG.height;
}
}
else {
alert("You must select an image file!");
Form1.reset();
}
}
divStr = "<Div Style='Position:Absolute;Top:-2000'><IMG Src=Null ID=nullIMG></Div>"
document.write(divStr)
Function fileSize(fileSpec)
Dim isSize
Set fso = CreateObject("Scripting.FileSystemObject")
Set contentFile = fso.GetFile(fileSpec)
isSize = contentFile.Size
fileSize = isSize
Set contentFile = Nothing
Set fso = Nothing
End Function
Choose an image:
File Name:
File Size:
Width:
Height:
|
|
|
|
|
Hi All,
I have only the WSDL file given to me.
My requirement is to consume this webservice programmatically through C# code.
Please guide me or show me the relevant link where I can get the knowledge.
Thanks and Regards.
Amarjeet
|
|
|
|
|
Is there any GridView control with DropDownList as its databound/template field?
If possible open source or free control
Thanks,
Ivan.
|
|
|
|
|
No but you can do it easily using nested gridview.for more information just search it as Nested Gridview in codeproject.com's search engine.
Enjoy...
|
|
|
|
|
Hi,
I have a certain peice of code written in master page, and on the click of a button which is on the master page i want to execute that code on the basis of the current page loadad in the contentplaceholder.
Please help me to find out a way by whihc i can determine which page is currently loaded in master-page.
Thanks.
Deepak Surana
|
|
|
|
|
I suspect that you can do this with reflection, or by examining the Id of the parent control. However, an easy way to build this would be to create an enum representing all the different pages, or even just those pages you especially want to recognise, and one value for all you don't. Make the page set this property in it's master page, in the init method. The property itself is a member variable of the master page.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
good morning!!
I'm using Ajax Beta 2.0 version in asp.net 2.0 ,after using UpdatePanel I got System.Request.PageRequestManagerServerException: An unknown error occure while processing the request on the server.Status code returned was 12031.
at the button click event .
why this exception is comming and how to solve this problem please guide.
Thank you
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
i have developed an apllication that contain html and aspx pages.but aspx pages are taking so much time to access.why it's like that?....
|
|
|
|
|
It will depend on what you are doing with the ASPX page. If you are accessing a database, some seek time occurs, if you are compressing pages added time occurs. There are many factors and usually there are way to at the very least reduce the slow loading.
What are the ASPX pages doing?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
I have a website with dotnet application which is a http site. i have to change a single page in the site into https page. ie., for ex.. if i have http://www.yahoo.com/inbox.aspx,... i have to change it to https://www.yahoo.com/inbox.aspx...... Further, my site is already RSA secured. I have SSL certificate also. Iam working with IIS server in windows XP. Anybody pls tell me the steps to convert Http to Https using SSL in Asp.Net?
Regards
Vijay.
|
|
|
|
|
It isn't the specific page that you need to make secure. You make the whole virtual site secure. Go into IIS and go to the properties page for the site you want secure. Look through the tabs and you'll find the certificates section pretty quick.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hey, thanks for ur reply. but i don't need the whole site to use https as it's not user-friendly and most users dont try to access the site using https. The thing is that i need to use one page as https ie.., if i login using RSA secure ID after logged in the page we access should only be shown in https to specify that they are logged in to a secure page. So pls help me.
|
|
|
|
|
SSL is not the page its the way the site is talking to the client. So what most companies do it create a new virtual site.
Example:
Main Site:
www.mysite.com
Secure Site:
secure.mysite.com
From your main site just redirect to the secure site and it'll work the way you want.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Thanks once again. But the thing is i don't know how to redirect to one single page and make it as https after logging in. Pls help me how to do the process.
|
|
|
|
|
Make both sites point to the same directory. Just redirect to https://www.mysite.com/mypage.aspx.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hi all
I am developing a asp.net application using vb. The problem i am facing is in one of the form i have a import button for text files that i need to save it in one of the folder(Resume) inside the application, I tried with all write permission but every time get a error. code what i wrote is
Private Sub CmdUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdUpload.Click
If File1.PostedFile Is Nothing Then
Me.lblResult.Text = "No File Selected to Upload."
Exit Sub
End If
'Retrieve file information and upload to server.
Dim strName As String
strName = System.IO.Path.GetFileName(File1.PostedFile.FileName)
Try
File1.PostedFile.SaveAs(Server.MapPath("Resumes/" & strName))
Me.lblResult.Text = """" + strName + """ was uploaded successfully."
Catch ex As Exception
Me.lblResult.Text = "An Error Occured While Uploading File."
End Try
End Sub
End Class
*******************************
Error what i am getting while debugging is
+ ex {System.UnauthorizedAccessException} System.Exception
***********************************
Pl help me
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Prakash_Mishra wrote: Error what i am getting while debugging is
+ ex {System.UnauthorizedAccessException} System.Exception
it is related to the registry key. so RegistryKey.SetAccessControl Method will help you to solve this problem.
For Details[^]
Regards,
Satips.
|
|
|
|
|
Hi,
I have been facing the variable scope problem since I started coding in ASP.NET (C#).
A variable I declare globally seems to be reset whenever it gets out of a function block.
For example, I have a label control named "lblURL" and a button named "cmdShow" on a web form with the following code:
<br />
public class MyClass: System.Web.UI.Page {<br />
private string _url = "";<br />
<br />
private void Page_Load(object sender, System.EventArgs e) {<br />
this.SetUrl();<br />
}<br />
<br />
private void SetUrl(){<br />
_url = "http://www.myWebSite.com";<br />
}<br />
<br />
private void cmdShow_Click(object sender, System.EventArgs e) {<br />
this.lblURL.Text = _url;<br />
}<br />
}<br />
When clicking on a button, I expect the label to display "http://www.myWebSite.com".
But it turns out to be blank.
I have tried debugging and found that the _url variable has been set properly in the SetUrl function.
But the value is gone after I click the button (_url = "" in cmdShow_Click() function).
Personally, I think it's the IsPostBack issue since I've never had this kind of problem with Windows Form programming.
But I don't know how to solve it.
Someone please tell me how it works and how to solve it.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
According to the code, it should work as you expected...
This is because when you press the button, both the page load event and the button click event will be fired.
The problem may be due to label box itself.
Try to set the label box property at design time and see if it is displayed
in the label box when you first run the application.
Or
try to replace _url with Session["_url"].
Regards,
Arun Kumar.A
|
|
|
|
|
Using the Session variable is what I did.
However, I wonder if there is any other way to work with it.
Thank you very much.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|