java - File Upload in fire fox -


iam not able upload files in firefox , safari iam able in explorer. when tried debug found out in case of ie upload browser giving entire file eg c:\documents , settings\jjayashree\my documents\price.csv in ff , safari upload widget giving file name no extension. code if (filename.contains("\")) { index = filename.lastindexof("\"); }

    if (this.filename != null && this.filename.trim().length() > 0 && index >= 0) {         this.filename = this.filename.substring(index + 1, this.filename.length());     int dotposition = filename.lastindexof('.');         string extension = filename.substring(dotposition + 1, filename.length());         try {              if (profiletype.equalsignorecase("sampleprofile")) {                 if (extension.equalsignorecase("csv")) {                     //filenametextbox.settext(this.filename);                     this.form.submit();                 } else {                     new customdialogbox(nexus.info_message, messageconstants.specify_file_name_msg).show();                 }             }     } catch (exception e) {            window.alert("specify_valid_file_name_msg");         }     } else {            window.alert("specify_a_file_msg");     } 

i changed if (this.filename != null && this.filename.trim().length() > 0) { this.filename = this.filename.substring(this.filename.lastindexof("\") + 1, this.filename.length()); }

i found working when same deployed in linux iam getting error

i hav doubt becos in dopost of servlet iam using filename.replace("\", "/");

is problem. . how wil mozilla encounter filename.replace() wil see , find nothing can replced , go or wil throw kind of exception

maybe try gwtupload? simplifies file loading 1 function call, , handles backend you. it's little complicated working there's tutorial on site on how it.

http://code.google.com/p/gwtupload/


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -