Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"NaN undefined" shows as file-size if empty file uploaded #894

Closed
pjetherton opened this issue Mar 6, 2017 · 0 comments
Closed

"NaN undefined" shows as file-size if empty file uploaded #894

pjetherton opened this issue Mar 6, 2017 · 0 comments

Comments

@pjetherton
Copy link

Steps to reproduce the issue

Minimal HTML example:

<!DOCTYPE html>
<html>
<head>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  <!-- Not recommended link for production use; just to demonstrate issue exists in current master -->
  <link href="https://rawgit.com/kartik-v/bootstrap-fileinput/master/css/fileinput.min.css" rel="stylesheet">
</head>
<body>
  <input id="file-input" name="files[]" type="file" multiple>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <!-- Not recommended link for production use; just to demonstrate issue exists in current master -->
  <script src="https://rawgit.com/kartik-v/bootstrap-fileinput/master/js/fileinput.min.js"></script>
  <script>$(function() { $('#file-input').fileinput({ 'previewFileType': 'any' }); });</script>
</body>
</html>

Upload a 0-byte file.

Expected behavior and actual behavior

(NaN undefined) appears below the filename in the previewer.

I would have expected (0 bytes) to appear instead.

Environment

Browsers

Tested in Chrome on Windows (10).

pjetherton added a commit to pjetherton/bootstrap-fileinput that referenced this issue Mar 6, 2017
Resolves kartik-v#894

0.00 B display is consistent with display of a one byte file (1.00 B) as per the general logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants