$meta = \OC\Files\Filesystem::getFileInfo($target);
// updated max file size after upload
$storageStats = \OCA\files\lib\Helper::buildFileStorageStatistics($dir);
-
- $result[] = array('status' => 'success',
- 'mime' => $meta['mimetype'],
- 'size' => $meta['size'],
- 'id' => $meta['fileid'],
- 'name' => basename($target),
- 'originalname' => $files['name'][$i],
- 'uploadMaxFilesize' => $maxUploadFileSize,
- 'maxHumanFilesize' => $maxHumanFileSize
- );
+ if ($meta === false) {
+ OCP\JSON::error(array('data' => array_merge(array('message' => $l->t('Upload failed')), $storageStats)));
+ exit();
+ } else {
+ $result[] = array('status' => 'success',
+ 'mime' => $meta['mimetype'],
+ 'size' => $meta['size'],
+ 'id' => $meta['fileid'],
+ 'name' => basename($target),
+ 'originalname' => $files['name'][$i],
+ 'uploadMaxFilesize' => $maxUploadFileSize,
+ 'maxHumanFilesize' => $maxHumanFileSize
+ );
+ }
}
}
OCP\JSON::encodedPrint($result);
var result=$.parseJSON(response);
if(typeof result[0] !== 'undefined' && result[0].status === 'success') {
+ var filename = result[0].originalname;
+
+ // delete jqXHR reference
+ if (typeof data.context !== 'undefined' && data.context.data('type') === 'dir') {
+ var dirName = data.context.data('file');
+ delete uploadingFiles[dirName][filename];
+ if ($.assocArraySize(uploadingFiles[dirName]) == 0) {
+ delete uploadingFiles[dirName];
+ }
+ } else {
+ delete uploadingFiles[filename];
+ }
var file = result[0];
} else {
data.textStatus = 'servererror';
var fu = $(this).data('blueimp-fileupload') || $(this).data('fileupload');
fu._trigger('fail', e, data);
}
-
- var filename = result[0].originalname;
-
- // delete jqXHR reference
- if (typeof data.context !== 'undefined' && data.context.data('type') === 'dir') {
- var dirName = data.context.data('file');
- delete uploadingFiles[dirName][filename];
- if ($.assocArraySize(uploadingFiles[dirName]) == 0) {
- delete uploadingFiles[dirName];
- }
- } else {
- delete uploadingFiles[filename];
- }
-
},
/**
* called after last upload
case 'xb':
case 'a':
case 'ab':
- if (!$this->isUpdatable($path)) {
- return false;
- }
+ $exists = $this->file_exists($path);
+ if ($exists && !$this->isUpdatable($path)) {
+ return false;
+ }
+ if (!$exists && !$this->isCreatable(dirname($path))) {
+ return false;
+ }
}
$info = array(
'target' => $this->sharedFolder.$path,