各位大哥! 上转功能,更改file默认的按钮后,上转提示找不到文件 jsp文件 /**
* 更换上转按钮
*/
function ChangeUppic(){
var value=document.getElementById("file").value;
document.getElementById("file1").value=value;
document.getElementById("file").value=value;
document.form1.file.value=value;
var info="<a href='javaScript:uppic();'><img src='images/f1_13b.gif' alt='' border='0' /></a>";
document.getElementById("Upload").innerHTML=info;
alert(document.form1.file.value);
} <input id="file1" type="text" name="txt" class="fwent" readonly onchange="ChangeUppic();"/>
<input type="file" id="file" onchange="ChangeUppic();" name="file" style="position:absolute; left:90px; top:8px; display:none;filter:alpha(opacity=0);opacity:0" size="1" hidefocus/><br/>
</div>
<div class="fcontentlttoth"><input type="image" src="images/f1_12.gif" value="请选择文件" size="30" onclick="file.click()"/></div>
<div class="fcontentlttoth" id="Upload">
上转处理文件SmartUpload mySmartUpload = new SmartUpload();
mySmartUpload.initialize(this.getServletConfig(),request, response);
try { mySmartUpload.setMaxFileSize(512*1024*1024);//设置允许上传文件最大为 bytes
mySmartUpload.setTotalMaxFileSize(500000000);//一次上传文件大小最多不超过5000000bytes
mySmartUpload.upload();
System.out.println(mySmartUpload.getFiles().getCount());
for(int i=0;i<mySmartUpload.getFiles().getCount();i++){
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);
String fileName = myFile.getFileName();
String path=myFile.getFilePathName();
String ext=myFile.getFileExt(); 输入的fileName,path,ext都出空!大哥们,那里出问题!该怎么解决!
最好有个例子!跪谢!
* 更换上转按钮
*/
function ChangeUppic(){
var value=document.getElementById("file").value;
document.getElementById("file1").value=value;
document.getElementById("file").value=value;
document.form1.file.value=value;
var info="<a href='javaScript:uppic();'><img src='images/f1_13b.gif' alt='' border='0' /></a>";
document.getElementById("Upload").innerHTML=info;
alert(document.form1.file.value);
} <input id="file1" type="text" name="txt" class="fwent" readonly onchange="ChangeUppic();"/>
<input type="file" id="file" onchange="ChangeUppic();" name="file" style="position:absolute; left:90px; top:8px; display:none;filter:alpha(opacity=0);opacity:0" size="1" hidefocus/><br/>
</div>
<div class="fcontentlttoth"><input type="image" src="images/f1_12.gif" value="请选择文件" size="30" onclick="file.click()"/></div>
<div class="fcontentlttoth" id="Upload">
上转处理文件SmartUpload mySmartUpload = new SmartUpload();
mySmartUpload.initialize(this.getServletConfig(),request, response);
try { mySmartUpload.setMaxFileSize(512*1024*1024);//设置允许上传文件最大为 bytes
mySmartUpload.setTotalMaxFileSize(500000000);//一次上传文件大小最多不超过5000000bytes
mySmartUpload.upload();
System.out.println(mySmartUpload.getFiles().getCount());
for(int i=0;i<mySmartUpload.getFiles().getCount();i++){
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);
String fileName = myFile.getFileName();
String path=myFile.getFilePathName();
String ext=myFile.getFileExt(); 输入的fileName,path,ext都出空!大哥们,那里出问题!该怎么解决!
最好有个例子!跪谢!
帮楼主顶帖
SmartUpload 网上不是很多现成的例子吗,实在不行就换Struts上传