Monday, May 10, 2010

How to Authenticate Uploaded file format, size at the GWT client side?

Hello Friends

My Problem is that I want to Authenticate Uploaded
file format, size at the GWT client side, But I not having no Idea,
I did my first attempt to do so in this way.....

1) By creating a method at the client side

public long getFileSize(String filename) {

File file = new File(filename);

if (!file.exists() || !file.isFile()) {
System.out.println("File doesn\'t exist");
return -1;
}

//Here we get the actual size
return file.length();
}


2) Call to the method...


long size =
getFileSize(textField.getName());
if(size>5242880)
{
MessageBox.alert("File Size exceed Upload Limits");
System.out.println("Filesize in bytes: " + size);
}
else
{
formPanel.getForm().submit(GWT.getModuleBaseURL()
+"FileUploadServlet", null, Connection.POST, "Saving Data...",
false);
}


*********************************************************************************************

But this is not working, I find the reason of this is that "GWT only
support Java.lang, java.lang package at client side."

Then Please tell me what i should do to authenticate the file size and
format at the client side before upload start.

I am waiting for response from my Respected group members .


Your Friend
Ankit

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate