OwnCloud Web interface does not allow the uploading of files that have an empty mime
Steps to reproduce:
- Upload a *.R file or a *.bundle file (those are the file types I have tested) via the web interface
- When the upload process finishes the following message is displayed: "Unable to upload your file as it is a directory or has 0 bytes"
What is expected: The file should be successfully uploaded.
It seems the problem is related to this line: Line 204 (in the core / apps / files / js / files.js file)
if(files[i].size ==0 || files[i].type== '')
After editing the indicated line, those files are successfully uploaded:
if(files[i].size ==0)
Also, there seems to be a similar problem when downloading those files (however I was not able to identify the javascript code responsible for the type validation during the download procedure)
Only checking the filesize will break the check for (at least) newer versions of chrome that return a non-0 size for folders
Then, what about this alternative?
if (files[i].type== '') {
if(files[i].size ==0) {
OC.dialogs.alert(t('files', 'Unable to upload your file as it is a directory or has 0 bytes'), t('files', 'Upload Error'));
return;
}
}
// Continue uploading
This is related to #131 (not possible to upload files without extension).
filetype: .epub
I have the same problem: "Unable to upload your file as it is a directory or has 0 bytes" using the native browser web interface. Please supply a fix soon.
Same error message is shown, when I change the file extension. I suppose, it is mime-type related. Please supply a fix soon, as this (bug) breaks usability of ownCloud in many cases.
Keep us informed here, or reply if you need further information and tests.
- Server version: 4.5.1a
blocker (usability of owncloud as such)
@Wikinaut can you supply more details on your environment? I have no problems with *.epub upload/download for 4.5.1a Linux/Apache/Sqlite
see screenshot
tested in these browsers
- Firefox 16.0.2
- IE 8.0
- Chrome Version 22.0.1229.94 m
What operating system are you using?
Wikinaut [email protected] wrote:
see screenshot
same message 
tested in these browsers
Firefox 16.0.2IE 8.0Chrome Version 22.0.1229.94 m
— Reply to this email directly or view it on GitHub.

- Windows XP for the clients
- Server owncloud 4.5.1a runs on OpenSuse 11.3 with Apache2
- https://
Then the problem probably is that windows doesn't detect the mimetype of the file, thus the browser can't distinguish between the file and a folder
Wikinaut [email protected] wrote:
Windows XP
— Reply to this email directly or view it on GitHub.

bug of owncloud, not of windows.
hint:
- "Dateierweiterung „.epub“ stimmt nicht mit dem MIME-Typ (application/zip) überein."
this is what my mediawiki says when I want to upload my .epub file to my mediawiki installation (of course, having .epub allowed as file type).
So most likely the problem is a mismatch between the extension (epub) and the detected mime type (zip). It should be however allowed to upload such files. We may encounter similar problems when uploading kmz files, for example.
Be reminded that uploading via the Windows Client 1.1.1 does work: moving the .epub from my desktop to the owncloud directory on my windows does result in an upload.
Thus, the upload via the browser should work, too.
see also
- https://github.com/owncloud/apps/commit/fadcfe08a7e4592ddc9bd254ac984b45eaa32013 "Do not rely on core mimetype detection"
- https://github.com/owncloud/android/commit/cce7e1247a5b91d6829b5bcc2f40bd1a47b45512 "assign octet-stream mimetype to unknown type file"
Suggestion to change the issue title from
- OwnCloud Web interface does not allow the uploading of files that have an empty mime
to
- OwnCloud Web interface does not allow uploading of files that have an empty mime type, or mime-type mismatching file extension
This is definitely an ownCloud issue, also the the same bug at https://github.com/owncloud/apps/issues/131
Hi , i have the "same" issue if i try to upload a file without extension
the problem is resolved by replacing the " || " back to " && " in
Line 204 (in the core / apps / files / js / files.js file)
if(files[i].size ==0 || files[i].type== '')
(i think you changed it some days ago @icewind1991 no? )
(Firefox 16 on linux) hope it helps a little
I changed it to fix some issues that allowed uploading a "folder" on newer chrome versions
I guess it's best to change it back, since this bug is worse then the one my change solved
Yeeeeahhhh! :v:
