Hi everyone,

I finally figured out a way to do this on my own so I figured I'd share in case someone else needs to know. I'm using the very cool audio module (http://drupal.org/project/audio) to add audio content to my site. The problem is that my host limits uploads at 16MB, which is too small for many of the files we want to add to the site. (Most are 17-24MB). We use Media Temple as our host. We've adjusted our .htaccess to allow 16mb but that is the limit.

I could have (and did once) just make a generic entry, upload the file via FTP and hard code the flash player link. This is not a good long term solution, and it makes the content type story instead of audio - kind of defeats the purpose.

So here's what you do.

1. Prepare your mp3 file, then dupe it and make a copy that has only like 10 seconds of audio in it, which will be nice and small.
2. Add audio content as normal, adding the "scratch" version during the upload process, and submit the content.
3. Now you have your audio node, but with the short file only. Take the full sized file and FTP over the scratch file.
4. Here's the catch - you *must* go to that node and enter edit mode for this to work. Simply dragging it over doesn't seem to do the trick. When you enter edit mode, you should see the MP3 details adjust to the larger file. Save the changes (even though you haven't actually done any editing)

And viola! You now have your large file uploaded as an audio node.

Tom

Comments

misteranderson’s picture

This workaround works like charm thanks.

hugafish’s picture

Could you elaborate more please on where and what htaccess file you are referring to I found one in my root folder but when I looked inside of it I saw no reference to file size limitations or any reference to files of any kind. Am I missing something, is this the wrong place to look on my server. I have Drupal on a hosted site. I am using the audio module which is a very cool module but the 2MB limitation is not going to work I need to set it to 4.5 MB in size. Thanks for helping in advance.

tdellaringa’s picture

You'll have to add the info to your htaccess to get it to work. I don't have the info handy right now at work, but if you search on htaccess and upload limit you should find it.

misteranderson’s picture

It is the file in the root. It should look something like this; (IMPORTANT MAKE A BACK UP OF YOUR FILE FIRST just in case)

register_globals=on
allow_url_fopen = off

expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12

add the code below in the space I left blank

memory_limit = 65M
post_max_size = 65M
file_uploads = On
upload_max_filesize = 65M

That's what I did and it did increase my upload limit, but not to the amount I wanted. Change the 65M s to the number you want example 5M for 5 MB. If your hosting provided allows that limit your good to go. If not you will have to use the work around.

hugafish’s picture

Hey thanks for the help guys, I added the code to my htaccess file and it basically took my site down, I could no longer browse my site. I went back into my host site through my cpanel and took the lines out and my site came back up. I contacted my host provider and they said I just needed to create a php.ini file in the root of drupal and add those lines of code there. I did that and it works great, I now have the ability to upload up to 5 MB files which is fine by what my site is designed for. One thing I noticed though in the audio module is that now it reports max size to be 4MB instead of 2MB that it used to say but it should be reporting 5MB, OH well no biggy deal.

steve-psngs’s picture

I checked out the .htaccess file in the root of my drupal site & it looks nothing like your one :

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.81.2.3 2007/09/21 12:24:22 drumm Exp $

So I'm not sure where I can add the code & in what format ?

Rix-UK’s picture

Guys,

This work around does the job but I believe there is a much quicker method.

The workaround requires FTP access and Admin access to drupal so you need to make sure you have these first.

What you need to do is create a tempory directory on your drupal site for example. tmp\audio

You can then upload as many mp3's and as big as you like via FTP to this directory.

Then login to your Drupal site as an Admin and goto Administer then click the 'By Module' tab and then under audio import click 'Audio Import Settings'

On the next screen set the directory to the one you used above and click save.

From now on whenever you wish to add audio nodes that are larger than the upload permits you can simply upload the audio to your temporary directory, login to Drupal and then click administer and then 'Audio Import'.

You can import multiple files at once using this method or simply just a few, and this way you do not need to mess around with your .htaccess file.

Hope that helps guys,

Rix

hugafish’s picture

The ftp method you mention is great if it is only the Admin of the site, unless you have your site set up to allow other users ftp capabilities to upload larger files that is. Or you plan on doing all the files for the other users of the site. Because of the way my site is handled I had to create an ini file to allow for larger upload of files, works great for me. I do wish the audio module had a graphic upload indicator to let users know that their file is still being uploaded and therefore keeping them from getting to anxious and leaving the page too soon. Am I missing something on this point, that is for a multiple user based site I'm talking about?

artis’s picture

It's pretty simple to add permissions granularity in Drupal 5. I needed to allow some users to import audio without allowing them access to all the audio settings so I hacked the '/audio/contrib/import/audio_import.module' file at about line 29 (5.x-2.x-dev)

was:         'access' => user_access('administer audio'),

now:         'access' => user_access('import audio'),

Then hacked '/audio/audio.module' file at about line 197 (5.x-2.x-dev)

was:      return array('administer audio', 'create audio', 'edit own audio',

now:        return array('administer audio', 'import audio', 'create audio', 'edit own audio',

Done. Now you have a new permission that says 'import audio'. Assign that permission to the role you want and those users will be able to import audio from the FTP directory.

bylshaun’s picture

I did this and was able to import the files. But how do a post these audio files once they've been imported??

steve-psngs’s picture

I just managed to fix this by adding this to the relevant part of the .htaccess file :

php_value post_max_size 200M
php_value upload_max_filesize 200M
php_value max_execution_time 1000
php_value max_input_time 1000

(added at the base of whichever PHP/Apache version the server uses)

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
----added here----
</IfModule>

Had to put 200m which now allows the upload/post max size as 100m.
Not sure why I had to double the amount to get only half ?
But it works.

hikarateboy’s picture