最佳答案
我正在将图像上传到一个 servlet。只有在服务器端通过检查文件头中的神奇数字来验证上传的文件是否是一个图像。在向 servlet 提交表单之前,是否有办法在客户端验证扩展?我一按回车键,它就开始上传。
我在客户端使用 Javascript 和 jQuery。
更新: 我终于结束了与服务器端验证,读取字节和拒绝上传,如果它不是一个图像。