大家看看我这个怎么获得文件的类型
大家看看我这个怎么获得文件的类型
jsp页面代码:
<form action="Album!savePhoto" enctype="multipart/form-data" method="post">
<input id="entity_id" type="hidden" name="entityId" value="<s:property value='album.id'/>" />
<div class="infos">
<dl id="album_create" class="field clearfix">
<dt>选择相册:</dt>
<dd>
<span class="select">
<input id="albumId" type="button" value="请选择相册" />
<ul class="hide">
<s:iterator value="albums" var="album" status="status">
<li><a href="javascript:selectAlbum(<s:property value='id'/>,<s:property value='name'/>);"><s:property value="#album.name"/></a></li>
</s:iterator>
</ul>
</span>
</dd>
<dt>相片名称:</dt>
<dd><input class="text" type="text" name="photoName" /><lable><s:actionmessage/></lable></dd>
<dt>本地浏览:</dt>
<dd><input class="text" type="file" name="photo" /></dd>
</dl>
</div>
<div class="buttons">
<p>你可以上传jpg,jpeg,gif,png或bmp文件。</p>
<label class="ui-btn-cancel"><input type="button" name="button" value="取消" onclick="window.location = 'Album.action';"/></label>
<label class="ui-btn-normal"><input type="submit" name="button" value="提交" /></label>
</div>
</form>
private String photoName;
public String getPhotoName()
{
return photoName;
}
public void setPhotoName(String filename)
{
this.photoName = filename;
}