Hi,

a little upload-module question:

I'm using drupal cvs to run a little website, mainly used as document storage.
Attaching .doc files and so on works really great, but now i'm trying to attach a rather large pdf file and it fails (with no error message).

I have checked administer->uploads and all is ok there
also /etc/php.ini is ok
and no php.ini in the drupal dir.

Anyone know of another place i should be looking ?
Please note that attaching works great, but the max filesize seems to be somewhere around 2MB

Comments

LuckyOne’s picture

Apache has the limit for uploads (posts) too.

rupatest’s picture

Hi,
As I know thr'o Apahe you can upload more them 2MB

gordon’s picture

Basically there are 2 options in the php.ini which can be set via the .htaccess or for 4.6 the settings.php file.

post_max_size
upload_max_filesize

These need to be set to as large as you require it.
--
Gordon Heydon
Heydon Consulting

--
Gordon Heydon

Ian Ward’s picture

Are you sure if it is only these two, or would you also have to set either or all of:

memory_limit
upload_tmp_dir
max_execution_time

for example, if the file is 100megs, does max execution time matter?

gordon’s picture

I am pretty sure that execution time starts once the php script starts. So upload time is not counted into this. And all of the download goes to directly to file so memory isn;t an issue, unless you read the entire file into memory.
--
Gordon Heydon
Heydon Consulting

--
Gordon Heydon

Ian Ward’s picture

Thanks for the reply...I have had two different types of failures: one is a 500 internal server error which makes me think it is something w/ the directive settings, and the other is from the browser "this documment contains no data" which looks like the browser lost connection w/ the site, and this is probably because the connection I am on blips in and out every 30 minutes. The upload is via flexinode's file upload field. I wonder if this fact matters?

JohnG’s picture

Gordon, please could you elaborate (idiot proof instructions) on how to do this?

I'm using 4.6 so I open settings.php and just past in something like:

post_max_size = 5mb
upload_max_filesize = 5mb

or do I need to edit the

//$conf = array(
//  'site_name' => 'My Drupal site',
//  'theme_default' => 'pushbutton',
//  'anonymous' => 'Visitor'
//);

?

gordon’s picture

for drupal 4.6 in the settings.php for you add the following lines.

ini_set('post_max_size', '5M');
ini_set('upload_max_filesize', '5M');

This will then allow you to upload files of upto 5meg.
--
Gordon Heydon
Heydon Consulting

--
Gordon Heydon

JohnG’s picture

thanks gordon - I'd never have guessed that one.

I was hoping that might solve a problem I'm having with both upload and attachment modules not wanting to upload.

If you wouldn't mind having a look at the details at http://drupal.org/node/22033

I suspect it's not the modules themselves, but something they both rely on ...?

I certainly appreciate your help.

tweaker’s picture

thanks gordon, I didn't know that either.

there is another question I have as well.

I'm trying to upload several file.zip files and instead of pulling them off my local hard drive, I would like to upload them from a different website I have.

I tried to paste the url in the attchement browse window , but it looks like it doesn't want to even consider that as an option

http://www.mysite.com/files/myfile.zip

type of address location - is there a way around this?

thanks

iraszl’s picture

I've added these lines to my settings.php file, but I still can't upload anything above appr. 2MB.

Is it because of this bug? What can I do about it?

Tx!
---
http://creativebits.org

JohnG’s picture

I've updated this thread: http://drupal.org/node/22033
It might help

argyle’s picture

i'm having this same issue with drupal 4.5.2

it seems perfect for my needs, but i'm finding i can't fit file sizes more than 2mb.

i've adjusted the 'maximum file size upload' to 10 and i've adjusted the 'total file size per user' to 100, and i'm still receiving the same problem.

while uploading, the browser takes a while, as if its uploading to a point. files under 2mb show in my 'files' folder as well as attached to the story. any files i attempt to upload higher than that do not show in the files directory or attached.

maui1’s picture

Hope someone has found a solution to this. I can't seem to get anything uploaded that is more than 2mb. I've tried adding to the htaccess file but got Internal Server Errors, and the settings.php file with no results.

sammos’s picture

Hm,
I've got the same issue with upload.module that was originally described here. When uploading a file more than about 2mb (I assume... I've tested with a 3mb file) it doesn't work. It seems like it might be timing out but i'm not sure. No error message. It tries to load for a long time and then the page just refreshes with no file uploaded.

I have added the settings Gordon provided to the settings file and upgraded to 4.6.2 to take advantage of the most recent patches with the upload module. Stil no luck.

Has anybody resolved this?

Thanks!

Chris Chiasson’s picture

It fails with no errors (even in the site logs), simply returning to the editing page after a long delay, as if I had never tried to upload a file. I set (both) limits to unlimited to deal with the problem, but no dice.

My website link is below, if you would like to register and test this error (I did not enable drupal.module):

Chris Chiasson

iraszl’s picture

I applied the change to settings.php as suggested and set the max file size to 20MB.

I managed to upload a 2.7MB file and it took a very long time on 56k up speed. But, a friend with fast upspeed tried a 17MB file and it failed.

So I can rule out the error of "timing out". I can also rule out the 2MB limit.

What else could be the issue I wonder?

Any help would be highly appreciated.

---
http://creativebits.org

Lam0r’s picture

Since I upgraded to 4.6.2 from 4.6.1 I had this problem. Any neat workaround ? Even fiddling around with settings in the uploads didnt help.

Carlos Miranda Levy’s picture

Admin can upload, but other users get file exceeded error...

If I log in as admin, I can upload/attach files.

But if I log in as another user, I get the following error (substitute IMG_3408.JPG with any file name tried).

Error attaching file IMG_3408.JPG: exceeds maximum file size

This is version 4.6.3, I did set all file upload limits to 0 for all roles.

It's not an apache or ph thing since I'm able to upload files as an admin.

One thing that came to mind was that I had set up taxonomy_access module and later disabled it and removed it. Will try and see if it's related.

But I don't have a clue of what's happening...

Finally found a solution by making

Maximum file size per upload: 1000
and
Total file size per user: 10000

Apparently the multiplication is not taking place. Don't have much time to look into the code now. But if you just add the zeros, it works ;-)

------
Con paciencia y calma,
sube un burro a una palma

Chris Chiasson’s picture

I still have these problems, even with UID 1, on 4.6.3. I will try your method of increasing the max file sizes to an actual number, but I think I already tried that before. Thanks. Chris Chiasson

adamr’s picture

I've run into the same problem with my Web hosting service--anytime I try to upload more than 2MB I am returned to the upload page with no explanation for why it didn't work. My server is set to have a 2MB default for uploads, and a 55MB default for posting.

I tried to raise the upload limit to 50MB, so I put the following into my .htaccess


php_value upload_max_filesize 52428800
php_value memory_limit 52430000
php_value max_execution_time 60

I tried adding similar commands to settings.php, without any sucess.

Still can't upload anything bigger than 2MB.

I don't have access to the http.conf, so I'm not sure exactly what rights I have with .htaccess, but I think that it's pretty liberal.

I'm just tired and rambling...

pholm’s picture

I'm using Drupal 4.6 and I also had silent errors which took me back to an empty post page while trying to upload files > 2MB. I am using the attachment module rather than the upload module. I read everything here and nothing helped until I edited my php.ini file. By default:

post_max_size = 8M
upload_max_filesize = 2M

Note that uploads go into the post data so if you want to upload 2 GB files, you need to change post_max_size to be > 2GB as well as upload_max_filesize. To make it work I changed it to say:

post_max_size = 1000M (setting to 0 causes nothing to post)
upload_max_filesize = 0 (unlimited upload size)

Curiously, none of the other settings suggested here worked for me. It seems that drupal's settings.php has no effect on this. Before I changed php.ini, I did the following to try to solve this problem:

ini_set('max_post_size', 10000000);
ini_set('upload_max_filesize', 10000000);

Made the above changes to my drupal/sites/site.domain.com/settings.php file, and changing the values had no apparent effect.

Added the following to my drupal/.htaccess file:
php_value post_max_size 10M
php_value upload_max_filesize 10M

This also had no effect. After fixing the problem by changing php.ini, I changed all of the .htaccess and settings.php values for upload and post size to 1 byte, and tried uploading a 12M file, and the upload succeeded. So not only does php.ini supercede the drupal settings, the drupal settings seem to be completely ignored. Maybe there is a setting somewhere in php.ini or elsewhere that needs to be changed to allow certain variables to be modified at run-time?

maui1’s picture

I did exactly the same steps you did to try and alter the max upload. I guess its good to have confirmation that all those steps just don't work (when they should) setting htaccess, and setting.php

Unfortunately on a shared host I just can't edit the php.ini file.

Anyone have any idea why the other steps don't work?

sepeck’s picture

Allow different things and have different methods for you to do them. My suggestion would be to contact your host and ask them. Give them what you would like the settings to be and see what they say?

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

cel4145’s picture

I've discovered that at my host, site5.com, I must create a new instance of php.ini and load it into all directory folders which need it. Had to dig through their support forums to find out how to do it. It's also complicated enough that I haven't bothered to do it yet, but apparently it is possible on some shared hosts.

pinkboi’s picture

php --ini
gets you the correct .ini every time.. you just need ssh access or whatever

briwood’s picture

So I don't have access to my php.ini and I just needed to get a file up and am too impatient to interact with the webhosting landlords. Here's what I did:

1) scp'd the file up to the proper directory:

scp some_file.mp3 somebody@example.com:www/files

(of course you could use sftp, ftp, etc.)

2) in that dir 'chmod 644' the file

3) to make the attachment show up in the proper node fire up mysql in console mode. select * from files; Based on the entry of a file correctly attached to that node, you can manually insert a record for the file you just scp'd up.

laryholland’s picture

http://drupal.org/node/66718#comment-128750

Be sure to make sure that the script is not timing out as well.

oc’s picture

Looks like a simple logic bug in the code...

I am going to test this out a fix and post ithe outcome in the other thread on this issue...

http://drupal.org/node/22033 for a possible fix!

-rich

geme4472’s picture

Under shared hosting and kept hitting the 2M wall. I also had no luck w/settings.php, but then I read that you can't set upload_max_filesize or post_max_size at runtime, so, from the instructions in another post, I set those in .htaccess in bytes , and everything works great! This is set to 15 meg(ish):

  php_value upload_max_filesize             15000000
  php_value post_max_size                   15000000
Barleyman’s picture

I added this to my .htaccess file and to my surprise it worked. Thanks for your post.

I was trying to upload 5-10 MB videos with flexinode and it kept giving me the message "file cannot be blank" or something like that.

trevelyan’s picture

... you may want to check you are editing the appropriate php.ini file. I ended up editing /etc/php.ini and messing around with htaccess files for about an hour. The correct php.ini file was not showing up when I ran "locate php.ini" as I hadn't run "updated". Anyone with server access may want to quickly check the location of the php.ini used in combination with the apache installation by creating a PHP node in drupal and letting it:

echo php_info()

This will provide detailed information on the values for the relevant variables, along with the location of the php.ini configuration file being used by Apache. Alternately, a quick:

updatedb
locate php.ini

Will show if there are any copies of php.ini lurking on your system in unexpected places. Mine ended up in "/usr/local/lib" rather than "/etc". Editing the correct php.ini file solved the problem quite quickly.

nealb13’s picture

This worked great for me!

ZekiBaka’s picture

My problem was that I had to put a php.ini file in the directory that I installed Drupal. The directory above my Drupal directory had one a php.ini file and I kept trying to edit it to change the upload limit. Then I heard that it is good to have a php.ini file in every directory that has php files if you want settings other than the default settings.

Hope this helps someone,
-Zeki

Baker’s picture

You rule my friend. Thanks for the perfect fix! I simply created a php.ini file from an example I found online. I then searched for upload_max_filesize and post_max_size, increased their values, and uploaded the php.ini file to my Drupal root directory.

varun_krishna’s picture

U Rock Zeki , u idea worked for me ....
Thanks a lot....