1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-13 09:01:59 +02:00

plupload wasn't displaying upload errors correctly.

This commit is contained in:
Cameron 2018-08-10 13:51:21 -07:00
parent 5df7313606
commit cc6155a226
2 changed files with 21 additions and 5 deletions

View File

@ -1936,8 +1936,13 @@ class e_file
* 8 - unknown file type
* 9 - unacceptable file type (prone to exploits)
*/
function isClean($filename, $target_name, $allowed_filetypes = array(), $unknown = false)
function isClean($filename, $target_name='', $allowed_filetypes = array(), $unknown = false)
{
if(empty($target_name)) // no temp file, just use the filename.
{
$target_name = $filename;
}
$this->setErrorNum(null);
// 1. Start by checking against filetypes - that's the easy one!
$file_ext = pathinfo($target_name, PATHINFO_EXTENSION);

View File

@ -676,10 +676,10 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
// Specify what files to browse for
filters: [
{title: "Image files", extensions: extImg || "jpg,gif,png,jpeg"},
{title: "Image files", extensions: extImg || "jpg,gif,png,jpeg,svg"},
{title: "Zip files", extensions: extArchive || "zip,gz,rar"},
{title: "Document files", extensions: extDoc || "pdf,doc,docx,xls,xlsm,xml"},
{title: "Media files", extensions: 'mp3,mp4,wav,ogg,webm,mid,midi,'},
{title: "Media files", extensions: 'mp3,mp4,wav,ogg,webm,mid,midi'},
{title: "Other files", extensions: 'torrent,txt'}
],
preinit: {
@ -693,9 +693,20 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
{
},
FileUploaded: function (up, file, info)
FileUploaded: function (up, file, info) // Called when a file has finished uploading
{
// Called when a file has finished uploading
// console.log(up);
// console.log(file);
// console.log(file);
var result = JSON.parse(info.response);
if(result.error)
{
alert(file.name + ': '+ result.error.message);
// $('.plupload_buttons').show();
return false;
}
// console.log(result);
},
UploadProgress: function (up, file)
{