FIX #954 MonstaFTP and empty files

This commit is contained in:
Ulrich Block 2017-01-08 11:05:26 +01:00
parent 7a1402feee
commit 12d6dbf77a
2 changed files with 5 additions and 6 deletions

View File

@ -183,8 +183,11 @@ function processFileUploads(e,isDrop,isFolder,globalFiles) {
// Count files to upload
globalFileUploadPreCount=0;
for (var i=0; i<items.length; i++) {
var item = items[i].webkitGetAsEntry();
traverseFileTree(item,"");
}
@ -525,9 +528,6 @@ function fileUploader(globalFiles,filePath,rowID,isFolder,isDrop) {
progressBar = document.getElementById('progress'+rowID);
progressBar.value = (e.loaded / e.total) * 100;
// Set the progress bar
//progressBar.innerHTML = Math.round(progressBar.value)+'%'; // Display % for unsupported browsers
// Display %age complete
document.getElementById('percent'+rowID).innerHTML = Math.round(progressBar.value) + '%';
}
@ -540,7 +540,6 @@ function fileUploader(globalFiles,filePath,rowID,isFolder,isDrop) {
xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xmlhttp.setRequestHeader("X-File-Size", file.size);
xmlhttp.setRequestHeader("X-File-Type", file.type);
xmlhttp.setRequestHeader("Content-Type", "multipart/form-data");
xmlhttp.send(file);
}
}

View File

@ -138,7 +138,7 @@ class Monsta {
###############################################
private function connectFTP() {
$this->ftpConnection = @ftp_connect($this->ftpIP, $this->ftpPort, 3);
$this->ftpConnection = @ftp_connect($this->ftpIP, $this->ftpPort, 15);
if ($this->ftpConnection) {
@ -3014,7 +3014,7 @@ class Monsta {
}
// Check if file reached server
if (file_put_contents($fp1,file_get_contents('php://input'))) {
if (file_put_contents($fp1, file_get_contents('php://input')) or (int) $ui->escaped('HTTP_X_FILE_SIZE','server') == 0) {
if (!@ftp_put($this->ftpConnection, $fp2, $fp1, FTP_BINARY)) {
if ($this->checkFirstCharTilde($fp2) == 1) {