---
title: "EXT 清空 inputType : 'file'"
author: "resp"
date: "2012-08-23T14:10:38Z"
tags: []
categories: ["Web前端"]
slug: "ext-inputtype-file"
draft: false
lastmod: "2012-08-23T14:10:38Z"
id: 1659707
url: "https://resp.iteye.com/blog/1659707"
---

对于 inputType : 'file', 的 field 在使用 form.reset()的时候 不能将文本框的路径给清除掉，可以用如下方法來清空：

var obj = document.getElementById("fileuploadfieldid");         
          obj.outerHTML = obj.outerHTML;

 同時，不能用Ext.getCmp('fileuploadfieldid').getValue()來取值，不然還會取到原先選擇的文件的路徑，

需要用document.getElementById("fileuploadfieldid").value來取值。