Diferencia entre revisiones de «Tamaño de archivo subido»

De MoodleDocs
m (tidy up)
m ({{Pendiente de traducir}})
Línea 1: Línea 1:
{{EnTraduccion}}
{{Pendiente de traducir}}
{{Instalación}}
{{Instalación}}
Probablemente la pregunta más frecuente en los foros de uso de Moodle en inglés y en otros idiomas sea "¿Cómo aumento el tamaño máximo de archivos que pueden subirse?" Los cambios que necesitan hacerse son los mismos para todas las versiones de Moodle; solamente que en diferentes sistemas operativos (Linux versus Windows) necesitan hacerse en sitios diferentes. El tamaño de los archivos subidos está restringido en varias formas y cada una en esta lista restringe lo siguiente:
Probablemente la pregunta más frecuente en los foros de uso de Moodle en inglés y en otros idiomas sea "¿Cómo aumento el tamaño máximo de archivos que pueden subirse?" Los cambios que necesitan hacerse son los mismos para todas las versiones de Moodle; solamente que en diferentes sistemas operativos (Linux versus Windows) necesitan hacerse en sitios diferentes. El tamaño de los archivos subidos está restringido en varias formas y cada una en esta lista restringe lo siguiente:

Revisión del 22:23 8 jul 2013

Nota: Pendiente de Traducir. ¡Anímese a traducir esta página!.     ( y otras páginas pendientes)

Probablemente la pregunta más frecuente en los foros de uso de Moodle en inglés y en otros idiomas sea "¿Cómo aumento el tamaño máximo de archivos que pueden subirse?" Los cambios que necesitan hacerse son los mismos para todas las versiones de Moodle; solamente que en diferentes sistemas operativos (Linux versus Windows) necesitan hacerse en sitios diferentes. El tamaño de los archivos subidos está restringido en varias formas y cada una en esta lista restringe lo siguiente:

A nivel del servidor
A nivel del sitio Moodle
A nivel del curso
A nivel de actividad

Este es un tema polémico, principalmente porque uno pensaría que debería de poderse configurar dentro de Moodle. Desafortunadamente, esto no funciona así, estos son asuntos del Entorno que deben configurarse en las carpetas del servidor y de PHP; Moodle no puede trabajar afuera de Moodle mismo.

Acceso físico al servidor

Estas instrucciones asumen que Usted tiene acceso administrativo y físico completo a su servidor. Si Usted está empleando un servidor alojado por tercero (hosted), entonces Usted probablemente necesitará buscar otras formas para aumentar su tamaño de archivos subidos.

Hay aspectos positivos y negativos para ambos métodos que se describen abajo. Si Usted modifica el archivo php.ini entonces los cambios afectarán a todas las aplicaciones PHP de su servidor. Dado que PHP5 solamente puede tener un archivo php.ini en su servidor, el método por php.ini trabajará con todos los servidores web presentes. El método mediante .htaccess solamente afectará a la carpeta en donde se localiza y a sus subcarpetas, pero Usted necesita tener ciertas configuraciones habilitadas en Apache.

Cómo funciona la restricción del tamaño del archivos

El Host puede configurar un límite para el tamaño máximo de archivo subido dentro del Entorno del servidor, lo cual Usted podría anular si es que el Host se lo permitiera. PHP tiene una configuración que usa para limitar el tamaño del archivo que maneja al cargar. El Host tiene este número configurado dentro de su archivo php.ini basándose en sus percepciones particulares y las necesidades de su clientela. Este tamaño aparece en Moodle en la caja combo desplegable en Administración > Seguridad > Políticas del sitio > Tamaño máximo de archivo subido. Usted puede cambiar esto en cualquier momento, para que se acomode a las necesidades de su sitio. En la página de Configuraciones del Curso, existe otra restricción más que puede configurarse. De ninguna manera sería posible que la configuración del curso sobrepase la configuración del sitio, ni que la configuración del Sitio sobrepase las configuraciones de php.ini, que no pueden anular las configuraciones del Servidor. La única excepción a esta regla es que Usted puede manipular simultáneamente las configuraciondes del Servidor y de PHP, lo que se describe más adelante.

Modificando el archivo php.ini

Estas instrucciones le muestran cómo cambiar el tamaño de archivos subidos al editar su archivo php.ini en su servidor.

Instrucciones para Ubuntu Linux

Estas instrucciones asumen que Usted ha instalado el paquete Moodle estándar, PHP5 y Apache 2 mediante apt-get y que dejó todo como una instalación estándar por defecto. En caso de que Usted mismo hubiera compilado todo, ¡se supone que Usted sabrá donde quedó su archivo php.ini!

Usted necesita editar las siguientes tres configuraciones en su archivo php.ini file localizado en: /etc/php5/apache2/

  • Type "sudo nano /etc/php5/apache2/php.ini"
  • Press Ctrl and W and type "post_max_size"
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl and W and type "upload_max_filesize"
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl and W and type "max_execution_time"
  • Change the value to 600
  • Press Ctrl and O
  • Press Ctrl and X
  • Type sudo /etc/init.d/apache2 restart

Ahora debería de parecer su nuevo límite de archivo subido en Administración > Seguridad > Políticas del sitio > Tamaño máximo de archivo subido


Instrucciones para XAMPP o Mac

Estas son instrucciones acerca de cómo hacer ésto para Moodle en una Mac que usa el paquete descargable de muestra de XAMPP sample download package available. (Esto no es para un servidor Mac en producción.)

  • Close down Apache and MySQL if they are running via the XAMPP Control app and close the XAMPP Control app
  • Open Finder and go to Applications
  • Navigate down and open the folder XAMPP / xamppfiles / etc
  • Open the file php.ini with TextEdit (or another plain text editor)
  • Search for the post_max_size setting and up this from 128M (the default) to more; 500M is the maximum
  • Do the same for upload_max_filesize (make the numbers the same)
  • Search for the max execution_time setting and up this to 300 (or more if you get timeouts on uploads)
  • Save the php.ini file
  • restart Apache and MySQL as usual


Note: You may get a "permission denied" error when saving the php.ini file unless you are logged in with admin access to your Mac. To work around this, you can set the /etc directory in which the php.ini file is located to be writable temporarily. For how to do that, see here or here.

Instrucciones para Windows XP y Windows Server 2003

These instructions presume that you have downloaded the latest PHP 5.3.x Windows zip package and extracted it to C:\PHP. If you have installed PHP to another location then change all references to "C:\PHP" to the location you installed PHP too.

lightbulb.png Download and install any text editor that can save the file in a UTF-8 format, Crimson Editor is one such, NotePad++ is another, use that instead of either Wordpad or Notepad! The issue is that WordPad or Notepad will include hidden characters that may not be compatible with the requirements of PHP.
  • Open C:\PHP
  • Right Click the php.ini file in this folder and choose "Open with..." selecting your editor of choice.
  • Press Ctrl + F and type "post_max_size" (click Find...", where needed)
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl + F and type "upload_max_filesize" (click Find...", where needed)
  • Change the value to the number of Mb you want your site to accept as uploads
  • Press Ctrl + F and type "max_execution_time" (click Find...", where needed)
  • Change the value to 600
  • Press Ctrl and S or the save button.
  • Exit your editor.
  • Restart your webserver to reload PHP with the edited changes.
    • For IIS
    • Open the Start Menu on your server and select "Run"
    • Type "iisreset /RESTART"
    • For Apache 2 and Windows XP
    • Go to Start > All Programs > Apache > Restart
    • For Apache 2 and Windows Server
    • The following command will work as long as you have installed Apache 2 as a service on your Windows Server
    • Open your Start Menu on your server and select "Run"
    • Type "httpd -k restart"

Your new file size limit should now appear in Administration > Security > Site Policies > Maximum uploaded file size

NOTA: Estas instrucciones también cubren el instalador de Xampp para Windows. Sólamente remplace C:\PHP con C:\Moodle\server\php y reinicie su Moodle con un procedimiento normal de paro-arranque.

Modificando el archivo de configuración de Apache

Instrucciones para Ubuntu Linux

Usted puede también necesitar editar el archivo config.php del directorio moodle:

  • Type "gksudo nautilus" to get root permissions
  • Navigate to /etc/moodle
  • Open apache.conf
  • Go to the "<IfModule mod_php5.c>" section
  • Change "php_value upload_max_filesize = 2M" to a higher value
  • Change "php_value post_max_size = 2M" to a higher value
  • Go to the "<IfModule mod_php4.c>" section
  • Change "php_value upload_max_filesize = 2M" to a higher value
  • Change "php_value post_max_size = 2M" to a higher value
  • Save file
  • Type sudo /etc/init.d/apache2 restart

Modificando el archivo .htaccess

The following instructions will only work on an Apache web server, and also the Apache server must have Overrides allowed. Traditionally, you could only use .htaccess files when PHP was run as a module of Apache, but with Apache 2.2, this appears to no longer be the case. You can now use the .htaccess file in either module or cgi forms. As well, allowing the use of .htaccess files will cause a performance hit on the server, not a desirable outcome either - so check with your Host.

The .htaccess file is a distributed configuration file, that is, it can be used on a per-folder basis to configure each user's folder and sub-folders. You cannot alter the "AllowOverrides" directive in the Apache configuration file with a .htaccess file, only the Host can set that manually. Usually the Host will place a .htaccess file into your site Root if they do allow you to override the server settings. You can edit it the same as below, and the overrides you set will work. Alternatively, you may create your own .htaccess file in your text editor. It may also be called something else, like .config. If you have any file that starts with a ., you might want to open it in your text editor, just out of curiosity.

Create a file called .htaccess in Moodle's main directory (where 'index.php' is located, not the 'moodledata' directory) that contains the following information:

php_value upload_max_filesize 20971520
php_value post_max_size 20971520
php_value max_execution_time 600

20971520 is the integer value for 20Mb. You can use the following site to convert MegaBytes to Bytes.

For a more complete description of how to edit the .htacess file, look at this page, Apache Tutorial: .htaccess files

Modificando la configuración de IIS 7.0/7.5(Windows Server 2008, Windows Server 2008 R2)

Primero aumente activity time out y request time out (lo que permite que los archivos grandes tengan éxito bajo conexiones lentas)

FastCGI Settings > Edit (Right-click on PHP application)
Set Process Model > Activity Timeout to '3600' (one hour)
Set Process Model > Request Timeout to '3600' (one hour)

Next set 'Maximum allowed content length'

Request Filtering > Edit Feature Settings:
Configure 'Maximum allowed content length' al tamaño de archivo (en bytes) deseado, por ejemplo: '536870912' para 512MB (el tamaño por defecto es de aproximadamente 28.6MB)

Servidor alojado (hosted)

Las cosas van a ser un poco diferentes con un servidor alojado por terceros (hosted) cuando le quiera cambiar el tamaño de archivos a subir y descargar. Probablemente le dirán que fabrique o que cambie el archivo .htaccess o que modifique al archivo php.ini.

lightbulb.png It might be a good idea to talk to with your service provider before you attempt anything. They probably have instructions on "how to" and may have their own limits for uploaded file size. Some hosts measure the file size in gigabytes and others in megabytes. If you are unhappy with their limits, then check your contract and consider changing your provider to one that has a limit and price that you like.

.htaccess con servidor alojado (hosted)

The one purpose of an .htaccess file is to override the the current limitations of both the server and the php.ini file. Your hosted server should inform you where that file needs be placed in your Moodle, but generally in the root is sufficient. They may already have a standard file you can use, if so, use it - but perhaps not.

To the .htaccess file add the lines:

 php_value upload_max_filesize 128M
 php_value post_max_size 128M
 

This will limit uploads to 128MB, but you can make it any size you agree with your provider. The wording may vary slightly, according to the demands of the server.

php.ini con servidor alojado (hosted)

Some servers will not allow you to change the moodle root .htaccess file and tell you to use a php.ini file for php directives. Here you can use the instruction located in the section above called Modificando el archivo php.ini.

Find the php.ini file in your moodle subfolder on your hosted server. You might want to copy the file as a backup just in case. Edit php.ini, find "upload_max_filesize" and post_max_size in the code. After the = change the number. Here the max filesize is 20 megabytes.

upload_max_filesize = 20M
post_max_size = 20M
lightbulb.png Still not changed? Some hosts using cpanel have a php config program under services/software. Use the "Single php.ini" option and make sure you note the location of the php.ini file to modify. This changes the .htaccess file in the same area and thus the server limit for all programs using php.

Vea también



Vea https://docs.moodle.org/24/en/File_upload_size