Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Limiting Upload File Size
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
There are various things that may affect the maximum size of file you can upload to EPrints. One of the most common is Apache's [https://httpd.apache.org/docs/2.4/mod/core.html#limitrequestbody LimitRequestBody] which by default limits the maximum file upload to 1 GiB. However, when uploading a file larger than 1 GiB with EPrints file uploader (i.e. on the Upload stage of the eprint workflow) rather than telling you this is not possible, it just sits there any never uploads the file. For both the reason above and that more generally you may want to stop users from uploading excessively large files, you may want to restrict the maximum file size that the EPrints file uploader will permit for upload and warn users if files are too large to upload rather than leaving them wondering what went wrong. This can be done by copy [[88_uploadmethod_file.js]] to you archive's ''cfg/static/javascript/auto/'' (creating such a directory if it does not already exist) and editing it as follows: 1. At the start of the file add the line, which sets ''max_size'' to 1 GiB (you can set this higher or lower if you want): max_size = 1*1024*1024*1024; //max file size allowed in bytes. 2. Around the two occurrences of <code>this.createFile (files[i]);</code> at an if statement to change it to the following: if (this.checkFilesize(files[i])) { this.createFile (files[i]); } 3. After the <code>handleFiles</code> function block, add another function called <code>checkFilesize</code> with the following code: /* * Check file size before uploading. */ checkFilesize: function(file){ if (file.size < max_size) { return 1; } eprints.currentRepository().phrase( {'Plugin/Screen/EPrint/UploadMethod/File:filesize_too_big':{} },function(phrase){ alert (file.name+": \n"+ phrase["Plugin/Screen/EPrint/UploadMethod/File:filesize_too_big"]); } ) ; return 0; }, 4. After the line <code>var percent = json.received / json.size;</code> add the following if block: if (json.size > max_size) { UploadMethod_cancel(uuid); eprints.currentRepository().phrase( {'Plugin/Screen/EPrint/UploadMethod/File:filesize_too_big':{} },function(phrase){ alert (phrase["Plugin/Screen/EPrint/UploadMethod/File:filesize_too_big"]); } ) ; } After these changes you will now need to add a phrase to warn the user when the file is to large. You can add this to either an existing or by creating you own new phrases file in your archive's ''cfg/lang/en/phrases/'' directory. <epp:phrase id="Plugin/Screen/EPrint/UploadMethod/File:filesize_too_big">The file size exceeds the limit allowed and cannot be uploaded.</epp:phrase> [[Category:Howto]]
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)