我有一个代码,我正在使用为了上传文件。它在我上传某些内容时正常工作,但是当我没有上传任何内容时,将显示消息“内部服务器错误”。Internet服务器错误SDK解析PHP不上传文件时
if (isset($_FILES['image'])) {
if ($_FILES['image']['size'] < 600000) {
// save file to Parse
$file = ParseFile::createFromData(
file_get_contents($_FILES['image']['tmp_name']),
$_FILES['image']['name'] );
$file->save();
} else {
echo "El archivo no se adjuntó porque rebasa el tamaño máximo permitido";
}
} else {
$file = "";
}
//The error remains if i take out this code which saves the image on the Parse database.
// So the problem is in the code above.
$report = new ParseObject("Report");
if (isset($file)) { $report->set("ImageFile", $file); }
$report->save();
喜尝试第一行,如果(计数($ _ FILES)> 0){... }并在使用file_get_contents($ _FILES ['image'] ['tmp_name'])之前,你需要检查文件是否存在 – volkinc
我仍然有同样的问题 –
什么行?错误应该给你错误行 – volkinc