android - java.lang.IllegalArgumentException: File /data/epay/share/Download/test280.mp4 cotains a path separator -


i've caught problem, not solved under advise. it's still prompt same error:

as i've saw in

file contains path separator.

the problem cause :

if (isvalidmediafile && (dir != null) ) {     boolean bfile = dir.exists();     log.i(tag,"file flag " + bfile);     if(!bfile){         dir.mkdirs();         //runtime.getruntime().exec("cp " + f + " " + f);     }     log.i(tag, "dir= " + dir.getpath());     try {         string file =                  srcfile.substring(srcfile.lastindexof("/")+1,                          srcfile.length());         file dstfile = new file(                 dir.getabsolutepath() + "/" + file);         log.i(tag, "dst =" + dstfile);         if(!dstfile.exists()){             dstfile.createnewfile();         }         //copyfile(srcfile, dstfile);         //fileinputstream in = context.openfileinput(srcfile);          file sfile = context.getfilestreampath(srcfile);         fileinputstream in = new fileinputstream(sfile);          bufferedinputstream bi =  new bufferedinputstream(in);          fileoutputstream out = context.openfileoutput(dstfile.getname(),                  context.mode_private);         bufferedoutputstream bo = new bufferedoutputstream(out);          byte[] b = new byte[8192];         int len;         while( (len = bi.read(b))!= -1) {             bo.write(b, 0,len);         }         out.flush();          bi.close();         bo.close();         in.close();         out.close();                         } catch (ioexception e) {         // todo: handle exception         e.printstacktrace();     }                } 

the log messages : java.lang.illegalargumentexception: file /data/epay/share/download/test280.mp4 cotains path separator @ android.app.contextimpl.makefilename(contextimpl.java:1682) @ android.app.contextimpl.getfilestreampath(contextimpl.java:541)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -