Error trying to upload multiple files (take 2!)

Permalink 4 users found helpful
I just read about this happening to someone else, but saw no resolution so thought I'd post here.

I'm trying to upload half a dozen images so i can use them in a slideshow - these images total less than 1mb all up.

I get the following error

An unknown error occurred while uploading the file. Please check that file uploads are enabled, and that your file does not exceed the size of the post_max_size or upload_max_filesize variables. File Uploads: 1 Max Upload File Size: 24M Post Max Size: 24M

Following this, concrete5 effectively shuts down - I get access denied on anything.

Weird thing is, I start my editing session again, upload files one by one and it all works fine?

Any help/points/tips/etc - btw I am using the latest version of Concrete5

myFullFlavour
 
ecomatt replied on at Permalink Reply
ecomatt
i started another thread about this but still no resolve? i think it has something to do with the server we are on. i have another server and don't have this issue???

for now i have an FTP droplet which i can bulk upload to the /files/incoming folder then i can get it through the more menu under "add incoming" its faster as i can upload 7files at a time with ftp. still it would be nice to get to the bottom of this?
glockops replied on at Permalink Reply
glockops
This is the thread discussion ecomatt is referring to:
http://www.concrete5.org/community/forums/usage/error_on_andquotupl...

I'm monitoring both hoping someone can help us out solving this.
Tony replied on at Permalink Reply
Tony
Who are you hosting with? sounds like it could be something to do with your server setup. trying up-ing these config variables in php.ini too:

max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 120 ; Maximum amount of time each script may spend parsing request data
memory_limit = 32M ; Maximum amount of memory a script may consume (8MB)
glockops replied on at Permalink Reply
glockops
I'm have the exact same problem (multiple uploads fail with the same error message, but single uploads work fine) and I recall asking my host to change these settings to fix a problem for upgrading the C5 calendar version.

Thanks for your suggestion, it will hopefully reduce my troubleshooting time.
myFullFlavour replied on at Permalink Reply
myFullFlavour
Like many others, I'm running C5 on a shared platform.

The hosting company refuses any changes to that file due to 'security reasons'.

Understandable - is there any work around?

I have a client right now who would be over the moon if he didn't have to upload everything individually...
glockops replied on at Permalink Reply
glockops
OK, I've been poking around on this issue.
The files that are associated with this action are:
/concrete/tools/files/importers/multiple.php
/concrete/helpers/validation/token.php
/concrete/libraries/file/importer.php

importer.php has the following (line 7-13):
$fp = FilePermissions::getGlobal();
if (!$fp->canAddFiles()) {
   $error = FileImporter::getErrorMessage(FileImporter::E_PHP_FILE_ERROR_DEFAULT);
   $info = array('message'=>$error, 'error' => true);
   print $jsh->encode($info);
   exit;
}


If you change E_PHP_FILE_ERROR_DEFAULT to another error type such as E_PHP_NO_FILE then when you're uploading multiple files, you'll get "Invalid File" rather than the default error message ("An unknown error occurred...")
glockops replied on at Permalink Reply
glockops
Server Error Log
[Wed Nov 18 21:42:15 2009] [error] [client #My IP#] PHP Warning: join() [<a href='function.join'>function.join</a>]: Invalid arguments passed in /home/smwc/public_html/concrete/tools/files/add_to_complete.php on line 15, referer:http://www.smwc.edu/dashboard/files/search/...
[Wed Nov 18 21:42:15 2009] [error] [client #My IP#] PHP Warning: join() [<a href='function.join'>function.join</a>]: Invalid arguments passed in /home/smwc/public_html/concrete/tools/files/add_to_complete.php on line 13, referer:http://www.smwc.edu/dashboard/files/search/...

Edit: Removed Code Tags
Also Edit: I get this error every single time I try to add multiple files, it's in my error logs dozens of times and always just from my IP.
Mnkras replied on at Permalink Reply
Mnkras
can you not post it in the code tags as recently the code tags add a bunch of other stuff to the code like making links with the href and everything :)
glockops replied on at Permalink Reply
glockops
Actually, I think this is from the pop-up box that appears after the files are loaded. 0 files were properly uploaded, so those Edit tags / properties links don't work.

Edit: Confirmed, these server errors are generated by the assign file set and edit properties links. So I doubt this will help with solving the multiple file upload issue.
colin4255 replied on at Permalink Reply
colin4255
If, like me you are using shared hosting and cannot manually change your hosting php.ini file, then the way around this is to set up or edit your current .htaccess file in the root of your site.

Whats happening is that your host has set certain values in terms of the total number of megabytes you can upload as a single file, and the total number of megabytes you can upload or 'post' as a group of files. Yours are set at a maximum of 24megabytes, so any files yu try to upload that come to more than this and the upload will fail. Thats why you are seeing the message.

Just edit your .htaccess file and put the following code in:-


php_value memory_limit 128M
php_value upload_max_filesize 15M
php_value post_max_size 15M

Where the top item is the number of megs you can use in terms of memory for running the site (if its working OK don't add or change this line if it exsists)!!

The second line is the biggest size of individual file you can upload, change the 15M to whatever you want - 25M, 50M etc.

The third line is the total value of the files you are trying to upload in a group (ie 10 files = say 30M) Then change this to read 30M or 50M, whatever you like.

Then just don't exceed these new maximums on any single or multiple files uploads and you'll be fine.

Many hosts set these to 8 and 10M respectively in the PHP set up, but using .htaccess file you can override these usually.
myFullFlavour replied on at Permalink Reply
myFullFlavour
Still no resolution for this.

Trying to use your .htaccess method results in an 'Internal Server Area'

I can't edit the server config files (shared hosting go figure).

Apparently my limits are 24mbit...Right now I'm trying to upload multiple images totalling about 200kb!

Any more ideas?
Tony replied on at Permalink Reply
Tony
You can try adding something like this to your code (maybe in config/site.php, or maybe somewhere closer to where the upload actually happens), but it might not work if php safe mode is on:

ini_set("post_max_size", "30M");
ini_set("upload_max_filesize", "30M");
ini_set("memory_limit", "16M" );
Tony replied on at Permalink Reply
Tony
or maybe it's one of these two:

ini_set("max-execution-time",600);
ini_set("max_input_time",600);
myFullFlavour replied on at Permalink Reply
myFullFlavour
Yeah no luck at this stage - no idea where those would go (and yes, the server is running php safe mode).

Would be great to find a solution - I don't think I'm the only one who has run into this issue.
ryan replied on at Permalink Reply
ryan
So I don't have a solution to this problem yet, but on the site that I can duplicate it on the problem is that the flash uploader looses the session and then the files don't get uploaded because of lack of permission.

The files involved are:
/concrete/startup/session.php
/concrete/tools/files/multiple.php

The flash uploader passes the
$_POST['ccm-session']
variable correctly, and it gets set in the session properly (according to session_id() return result) But the value of the session variables are set to be the guest user by the time it gets to the multiple.php file.

I'm thinking it has to do with some session related ini setting.
Anyone have any thoughts on this?
ryan replied on at Permalink Best Answer Reply
ryan
So, Andy got this one sorted out with one of our clients on a rackspace box (cloud really).

Here's the cause of the problem:

The multi-file uploader has to create a new session with each request because the flash uploader app is acting as the client, it then sets the session_id so it can access the existing session data. When running in a cluster/cloud environment the session_id may match, but the session data may or may not be accessible depending on which physical machine is handling the request.

Here's a post on rackspace that addresses the problem:
http://cloudsites.rackspacecloud.com/index.php/Why_are_my_PHP_sessi...

Basically you need to specify the session.save_path so the session data is referenced consistently across different requests.
myFullFlavour replied on at Permalink Reply
myFullFlavour
We aren't running Concrete5 on a cloud though - its a single server (admittedly shared with other users at present) based in a national datacentre.

Further thoughts to a permanent fix?
dom replied on at Permalink Reply
dom
we got the same scenario.. no cloud, three single servers in a national datacenter (placed in germany) managed with SysCP.. and the multi upload problem occurs after upgrading to C5 version 5.3.3.1.. the server configuration didn't change between the C5 updates..
andrew replied on at Permalink Reply
andrew
I'm most interested in the "access denied" part of this question Try this. Try uploading multiple files. Make sure that it fails in the way that you mentioned. Then, reload the page entirely. Are you kicked out of edit mode so that you have to login? Do you lose the edit bar?

What's the URL of your site?
dom replied on at Permalink Reply
dom
..bingo.. our sites got exactly the described behavior.. after the the upload fails, your logged out..

..one of our sites:http://san-dan.nl/
myFullFlavour replied on at Permalink Reply
myFullFlavour
Correct. I'm also logged out completely and have to re login.

Doing this is the only time I come across this problem.
bkleinhe replied on at Permalink Reply
bkleinhe
same thing for me, on a shared server at icdsoft.com, trying to upload any number of files, all <100kb,,,always get error 421...they upload fine individually.
bkleinhe replied on at Permalink Reply
bkleinhe
sorry it was Upload Error 412...not 421..anyways I typed that into Google and found an answer on the Drupal forum:

I got it fixed by adding in the htaccess these lines :

SecFilterEngine Off
SecFilterScanPOST Off

It was a mod_security problem.

works sweet now.
nige replied on at Permalink Reply
nige
I have this problem with a shared server environment.

I'd like to try the .htaccess thing but whenever I put code into that file it breaks the site ie cant see a thing but an error message:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

Sooo, how do I edit that .htaccess file correctly without generating that error. I read somewhere there was a special way to edit these files.

Nige
nige replied on at Permalink Reply
nige
I have this problem with a shared server environment.

I'd like to try the .htaccess thing but whenever I put code into that file it breaks the site ie cant see a thing but an error message:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

Sooo, how do I edit that .htaccess file correctly without generating that error. I read somewhere there was a special way to edit these files.

Nige
tgdesign replied on at Permalink Reply
in regards to your .htaccess issue resulting in the internal server error:

Your host is most likely running mod_suPHP which won't allow you to add values like this at all in .htaccess.

I'm just trying to get the multiple (image) upload to work, will get back here once I've got some more info.

Does anyone know if suhosin could cause a problem?
dom replied on at Permalink Reply
dom
..don't know if suhosin causes this problem, but we got it running on our machines too and we are having these problems with the multi-uploader.. the solution to add the SecFilter directives to the .htaccess (posted by bkleinhe) results in a server failure too..
bluewater replied on at Permalink Reply
bluewater
I'm another with this problem....

Just installed a new site using the latest version and this problem exists....

It's fine with the older versions of C5 I'm using for other sites....
melat0nin replied on at Permalink Reply
melat0nin
That behaviour describes what's happening with my site.

Any thoughts? I have complete control over the server's config so I'm happy to hack away at php.ini or whatever. I have suPHP and Suhosin installed, if that makes any difference.

phpinfo() available here:http://r33769.ovh.net/phpinfo.php...
dom replied on at Permalink Reply
dom
ping.. we're also still struggling with this problem..
dolfs replied on at Permalink Reply
For those of use on single server installations (although this may also happen on multi server installations):

After a lot of reading of messages regarding SWFUpload and CakePHP I got a hint about the problem. The script called by SWFUpload re-establishes the session (through the session id) so that it can access information for the logged in user.

If you have suhosin installed, you may have session encryption installed. If so, it may use the "User Agent" header to create the encryption key. This "User Agent" is not the same as for your browser and thus a different key is used, causing access to the session to fail. This in turn causes the code to think you have no permission to upload files, with the "Unknown error" result.

The solution is to modify your suhosin setting to include (the default has this on):
suhosin.session.cryptua = Off

There may be a better way in the future of changing the code to copy the UA header from the browser, but for now this will work, with fairly minimal security consequences.
dom replied on at Permalink Reply
dom
thanx a lot.. man, you made my day..! :)

..this was excactly the right solution for us ..we are running two servers with multiple c5 installations, which all had this problem..

..we should mark your answer as the best now.. ^^

..i really appreciate that you took the time to post on such an old thread.. this is what a good community is about..

cheers
plschneide replied on at Permalink Reply
plschneide
Hi I am struggling with this as well. My hosting service - jumpline.com has been fine. I had the site on a IP based (single box) server and no problem. I moved it to a name server (shared account) and now I am getting the

An unknown error occurred while uploading the file. Please check that file uploads are enabled, and that your file does not exceed the size of the post_max_size or upload_max_filesize variables. File Uploads: 1 Max Upload File Size: 2M Post Max Size: 8M

error.

I've tried a variety of the things here - this is my latest modified .ini file

memory_limit = 32M
allow_url_fopen = on
suhosin.session.cryptua = Off
SecFilterEngine = Off
SecFilterScanPOST = Off
suhosin.request.max_vars = 500
suhosin.post_vars = 500
php_value session.gc_probability 1
php_value session.gc_divisor 100
php_value session.gc_maxlifetime 3600
php_value session.save_path /var/www/html/sessions

(full info here:http://fantaseadive.com/phpinfo.php)...

None of these changes seems to have improved the situation.


Any other ideas???

OH I also have been trying to upload a "bookmark" icon and I click on the save button and nothing happens... wonder if it is related.. (My single file upload works intermittently as well)
myFullFlavour replied on at Permalink Reply
myFullFlavour
You need to adjust your max post and upload size limits.

Contact your host to find out how to do this.


Best,
Jesse

Pecked out on a mobile device
plschneide replied on at Permalink Reply
plschneide
I am pretty sure that is not it. I was uploading 6 files about 3k each. For the heck of it I just upped my upload_max_filesize to 30M and post_max_size to 30M and same results.

Other ideas???
plschneide replied on at Permalink Reply
plschneide
More info: I uploaded them directly to the upload folder (via FTP) and that option worked (naturally).

I then just tried to use the Multiple Uploader option to upload a single file and I get the same error as if I tried to upload multiple files.
plschneide replied on at Permalink Reply
plschneide
Okay some new info.

Today I just discovered that on my site on a shared server, using IE8 and Flash 10.2 the multiple file upload works perfectly fine. Using Firefox 4x and Flash it does NOT work (I was using firfox 3.6 before with the same results)

So it seems IE is the magic bullet here. Anyone have ideas why IE would be working and NOT firefox? Seems like a weird potential incompatibility with some server settings and a non IE browser. On my single IP (non shared) firefox works fine.
plschneide replied on at Permalink Reply
plschneide
Anybody else who had this problem find that IE 8 works but not Firefox?

Now Firefox DOES work on my non shared server, but on the shared server IE works fine but Firefox does not. Would make me think there are some coding issues as well.

FYI I tried it with Safari and Chrome as well (all on Windows 7 platform) and all others failed.

The error I get with a non IE browser is:

An unknown error occurred while uploading the file. Please check that file uploads are enabled, and that your file does not exceed the size of the post_max_size or upload_max_filesize variables. File Uploads: 1 Max Upload File Size: 30M Post Max Size: 30M

It can't simply be "server" related if IE8 works... can it?

Any ideas?
djes replied on at Permalink Reply
djes
Same error. It works with IE(7!), but not with chrome, nor firefox :/
Steevb replied on at Permalink Reply
Steevb
I thought it was a AJAX/Flash thing?

Didn't think it mattered what platform/browser you use?

If I remember correctly there was an issue, but that was resolved a long while ago?

I still blame my browser, server and broadband for most things.

Locally, don't get so many issues!

Modern browsers update themselves, at least they do on my MAC, and windows should ask you to update stuff, right?

Clear your Cashe, update everything, cross your fingers and shout very loudly out of your window...

...I BEING OF SOUND MIND AND BODY DO F****** HATE W******!

See if that works?
djes replied on at Permalink Reply
djes
I have already tested all of that, and most. I don't understand why it works with IE (7, not 8!), and not chrome and so on. I'll search again and again.
Sadu replied on at Permalink Reply
Sadu
suhosin.session.cryptua = Off

This fixed it for me as well. Cheers.

In our case the site is on a shared host, but the host was willing to come to the party and make the change for us.
piciu replied on at Permalink Reply
Hi,

I get the same error when trying to upload multiple files. It's strange that until today it worked an suddenly it doesn't. And I have 3 sites with the same problem. I'm using concrete 5.4.1.1

George
djes replied on at Permalink Reply
djes
djes replied on at Permalink Reply
djes
Wouldn't it be possible to use plupload instead of swfupload (http://www.plupload.com), because swfupload, relying only on flash, is not cross-browser compatible, not proxy compatible, not bug proof with authentification, and as a lot of known issues (see the documentation) ?
notzen replied on at Permalink Reply
notzen
Hi agree,

I have try a number of possible solutions but I do not resolve this issue.

use plupload could be a possible solution.