I'm trying to reference an existing file that was already uploaded via FTP and attached to another node. When trying to reference this file in a new node, the following error occurs:

"The selected file file.zip could not be referenced. The file is 10.52 MB exceeding the maximum file size of 7 MB." [FYI, 7MB is the PHP limit]

In this instance, shouldn't the expected behavior be to bypass the size limit check? Did I forget to properly configure something?

Comments

geerlingguy’s picture

I am also interested in this answer, as I have a large video file I uploaded through FTP that I'd like to reference without having to make a hard link in my node body.

TheDanScott’s picture

You can add my voice to those interested in an answer to this question as I am trying to reference an existing 70MB file.

While on the subject of large files in drupal, I also find that the filefield sources "attach" source won't handle files over (approximately) 80MB on the (shared) server I am using. How does the file copying process work? does it require enough RAM to hold the entire file? or does it load chunks of the file as it copies (if so, how much RAM is necessary)?

quicksketch’s picture

How does the file copying process work?

FileField Sources copies the file to the tmp directory, then tries to move it from the tmp directory to the final location. After moving the file successfully, it deletes the original file. All operations are done directly through PHP's copy() and rename() functions, which shouldn't need any large amount of memory to accomplish. My guess is that your host doesn't allow use of these functions with files over a certain limit.

quicksketch’s picture

Title: Reference existing enforces file size upload limit (file initially uploaded via FTP) » Do not enforce file size upload limit when referencing existing files
Component: Code » Source: Auto-complete
Status: Active » Fixed
StatusFileSize
new2.27 KB
new852 bytes

I've committed the attached patches which remove the file size limit when reusing files through the auto-complete source.

@TheSchmuck: Let's keep this issue on focus. See #964246: Attaching 326MB file gives Javascript Error 500 for further discussion on your question.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

claude’s picture

Title: Do not enforce file size upload limit when referencing existing files » File size validation error , after attach file and try to save the bnode.
Version: 6.x-1.2 » 7.x-1.7
Component: Source: Auto-complete » Source: Attach (FTP)
Priority: Normal » Critical
Status: Closed (fixed) » Active
StatusFileSize
new45.94 KB

I am getting a validation error , after I submit the page:
My steps:
- Logged in as a normal user , not the super admin
- Uploaded the file to server , under /sites/default/files/file_attach
- Create a video node
- Under my file field , Clicked on File attach
- Selected the file from the list and press Save to save the node , then the file size validation error appears .

Note :
- Logged in as a normal user , not the administrator

quicksketch’s picture

Hm, but the file saves anyway? Do you get the same error if you click on the "Attach" button instead of the "Save" button for the whole form?

In the future, it would probably be better to make a new issue for a report like this, considering the first (separate, but similar) problem appears to have already been fixed some time ago.

quicksketch’s picture

Priority: Critical » Normal
cousimo’s picture

I have the same issue, and it doesn't save node.

it seems to be a permission issue, because it does work when i log in as admin, but it doesn't work for any of our other staff.
I cant seem to find where the settings is to fix this

danielphenry’s picture

Priority: Normal » Major
Issue summary: View changes

This issue is occurring for me as well. It occurs for non super user.

It occurs when you select "save" node. I have tried selecting the attachment then selecting save node and also by selecting attach, waiting for the file to attach (which is successful) and then selecting save node.

The file is moved to the expected location but simply fails to be attached to the node.

As our primary use case for this module is to attach files too big to upload it makes this module unusable. Changing back to high priority.

danielphenry’s picture

Found the cause of this. For me at least and I assume many of the rest of you. I was using a video field. Which runs a separate validation of the file size and extensions in hook_field_validate. The function can not be overridden cleanly so we are at the mercy of the video module to fix this issue.

I created a case in the video module here: https://drupal.org/node/2175181

  • quicksketch committed 9aebfb4 on 8.x-1.x
    Issue #938348: Do not enforce file size upload limit when referencing...
sthomen’s picture

In case anyone is still using d7 and IMCE, this adds @quicksketch's fix to that reference source too.

--- imce.inc.orig       2019-04-17 11:33:04.824112400 +0300
+++ imce.inc    2019-04-17 11:32:40.491014500 +0300
@@ -169,6 +169,11 @@
       ->fetchField();
     if ($fid) {
       $file = file_load($fid);
+      // Remove file size restrictions, since the file already exists on disk.
+      if (isset($element['#upload_validators']['file_validate_size'])) {
+        unset($element['#upload_validators']['file_validate_size']);
+      }
+
       if (filefield_sources_element_validate($element, $file)) {
         $item = array_merge($item, (array) $file);
       }