mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 14:21:23 +00:00
check file size before upload file via upload link
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, maxUploadFileSize } from '../../utils/constants';
|
import { gettext, maxUploadFileSize } from '../../utils/constants';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
@@ -10,7 +11,7 @@ class ForbidUploadListItem extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { file } = this.props;
|
let { file } = this.props;
|
||||||
let msg = gettext('Please upload files less than {placeholder}M').replace('{placeholder}', maxUploadFileSize);
|
let msg = gettext('Please upload files less than {placeholder}').replace('{placeholder}', Utils.bytesToSize(maxUploadFileSize * 1000 * 1000));
|
||||||
return (
|
return (
|
||||||
<tr className="file-upload-item">
|
<tr className="file-upload-item">
|
||||||
<td className="upload-name">
|
<td className="upload-name">
|
||||||
|
@@ -49,7 +49,7 @@ class SharedUploadLink extends React.Component {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<ol className="small text-gray">
|
<ol className="small text-gray">
|
||||||
<li className="tip-list-item">{gettext('Folder upload is limited to Chrome, Firefox 50+, and Microsoft Edge.')}</li>
|
<li className="tip-list-item">{gettext('Folder upload is limited to Chrome, Firefox 50+, and Microsoft Edge.')}</li>
|
||||||
{maxUploadFileSize && <li className="tip-list-item">{gettext('File size should be smaller than {max_size_placeholder}M.').replace('{max_size_placeholder}', maxUploadFileSize)}</li>}
|
{maxUploadFileSize && <li className="tip-list-item">{gettext('File size should be smaller than {max_size_placeholder}.').replace('{max_size_placeholder}', Utils.bytesToSize(maxUploadFileSize * 1000 * 1000))}</li>}
|
||||||
</ol>
|
</ol>
|
||||||
<div id="upload-link-drop-zone" className="text-center mt-2 mb-4">
|
<div id="upload-link-drop-zone" className="text-center mt-2 mb-4">
|
||||||
<span className="sf3-font sf3-font-upload upload-icon"></span>
|
<span className="sf3-font sf3-font-upload upload-icon"></span>
|
||||||
|
Reference in New Issue
Block a user