我正在使用可用的普通上传API将文件上传到服务器。现在我想检查一下上传的文件是否为合法文件。
我可以有多个文件上传框在页面上。它们具有不同的要求并且应该接受不同类型的文件。
例如:
Input file 1 should take just exe
Input file 2 should take just html
Input file 3 should take just pptx
我可以检查扩展名,检查是一种解决方案,但这可能会发生,有人可能会伪造扩展名并上传txt文件,而不是exe等等
那么,我如何使用Java检查上传的文件类型是否正确呢
我得到了一些同样的东西的,但我不确定怎么做。
我正在用vaadin开发我的第一个应用程序。现在我正在尝试定制上传组件。总而言之,我必须上传一张图片。
现在我的组件以一种标准的方式实现:
public OutputStream receiveUpload(String filename,String mimeType) {
// Create upload stream
FileOutputStream fos = null; // Stream to write to
try {
// Open the file for writing.
file = new File("/tmp/uploads/" +
我用Cordova v11构建发行版,然后在它上签名。然后我把它上传到游戏商店。我收到一条消息
You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again.
所以我用了with和
zipalign" -f -v 4 app-release.apk aligned.apk
当我上传那个文件时,游戏商店告诉我
You uploaded an APK with an invalid signature (learn more
我有这个脚本来将图像或音频文件上传到服务器中。
<?php
include "config.php";
function GetImageExtension($imagetype)
{
if(empty($imagetype)) return false;
switch($imagetype)
{
case 'image/bmp': return '.bmp';
case 'image/gif': return '.gif';
case '