我试图通过PHP将上传的文件存储在MySQL数据库中。执行查询时,它返回true。但是,在重新提交文件时,上传的文件为0字节。请帮我解决这个问题。我已使用以下代码执行查询。
package javapractice2;
import java.util.ArrayList;
import java.util.Collections;
public class Mainclass {
public static void main(String[] args) {
ArrayList<Player> ply = new ArrayList<Player>();
ply.add(new Player ("kuldeep", 85));
ply.add(new Player ("jadeja", 75));
ply.add(new Player ("dohni", 48));
ply.add(new Player ("kozhi", 78));
ply.add(new Player ("raina", 48));
ply.add(new Player ("sachin", 85));
ply.add(new Player ("yuvaraj", 100));
ply.add(new Player ("Ajinkya", 85));
ply.add(new Player ("baji", 75));
ply.add(new Player ("hardik", 55));
Collections.sort(ply, new Sortbyname());
for(int i=0; i<ply.size(); i++){
System.out.println(ply.get(i));
}
}
}
答案 0 :(得分:0)
你正在混淆$ _POST和$ _FILE。将您的代码更新为以下内容:
if(isset($_FILE['file'])){
$cv_file = file_get_contents($_FILES['file']);
}else{
echo "file not uploaded";
}