Foros del Web » Programando para Internet » PHP »

upload me limita a 2mb

Estas en el tema de upload me limita a 2mb en el foro de PHP en Foros del Web. Amigos tengo el siguiente problema intento cargar un mp3 de mas de 2mb y no me permite este es mi archivo index.php <input style="width:350px; height:30px; ...
  #1 (permalink)  
Antiguo 10/03/2015, 08:35
 
Fecha de Ingreso: marzo-2009
Mensajes: 117
Antigüedad: 15 años, 1 mes
Puntos: 2
upload me limita a 2mb

Amigos tengo el siguiente problema

intento cargar un mp3 de mas de 2mb y no me permite

este es mi archivo index.php

<input style="width:350px; height:30px; text-align:center; font-family:fantasy" placeholder="Nombre de cancion o artista" type="text" name="id" id="buscar">
<input style="width:100px" type="submit" class="btn btn-success" value="Buscar">
</form>
</fieldset>
</center>
<div class="container-main">
<h1>Audio Upload</h1>
<p>By Deckso Gamez</p>

<form action="upload.php" method="post" id="myForm"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" class="btn btn-success" value="Upload Audio">
</form>

<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0"
aria-valuemax="100" style="width: 0%">
<span class="sr-only">0% Complete</span>
</div>
</div>
<div style="background: #5CB85C; border-radius: 3px; color: #F0F0F0; font-size: 12pt; margin: 3px; text-align:center;" class="image"></div>
<div style="background: #FF2525; border-radius: 3px; color: #F0F0F0; font-size: 12pt; margin: 3px; text-align:center;" class="error"></div>
</div>
<center><table class="tbl1" cellpadding="2" cellspacing="1" width="500">
<tbody><tr class="hdr"><td colspan="2"><a href="/">Archivos subidos</a></td></tr>
aki
<?php
function bytes2English($filesize)
{
if ($filesize<1048676)
RETURN number_format($filesize/1024,1) . " KB";
if ($filesize>=1048576 && $filesize<1073741824)
RETURN number_format($filesize/1048576,1) . " MB";
if ($filesize>=1073741824 && $filesize<1099511627776)
RETURN number_format($filesize/1073741824,2) . " GB";
if ($filesize>=1099511627776)
RETURN number_format($filesize/1099511627776,2) . " TB";
if ($filesize>=1125899906842624) //Currently, PB won't show due to PHP limitations
RETURN number_format($filesize/1125899906842624,3) . " PB";
}
$query = mysql_query("SELECT * FROM archivos ORDER BY ID DESC LIMIT 10");
while($row = mysql_fetch_assoc($query))

{

$id = $row['ID'];
$name = $row['Name'];
$tam = $row['Tam'];
$mb = bytes2english($tam);
echo "<tr><td><a href='file.php?id=$id'>$name</a></td><td width='1%' nowrap='' align='right'> $mb </td></tr>";

//echo "<tr><td><a href='download.php?file=$id'>$name</a></td><td width='1%' nowrap='' align='right'> $mb </td></tr>";

}


?>
</tbody></table></center>
<br /><br /><br />
</body>
</html>



file.php
<?php include('config.php');
if (isset($_GET['id']))

{
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM archivos WHERE id='$id'");
while($row = mysql_fetch_assoc($query))
{
$enlace = $row['ID'];
$name = $row['Name'];
$url = $row['Url'];
$tamaño = $row['Tam'];
}

}
else

{
header('Location: 404.php');
}
function bytes2English($filesize)
{

if ($filesize<1048676)
RETURN number_format($filesize/1024,1) . " KB";
if ($filesize>=1048576 && $filesize<1073741824)
RETURN number_format($filesize/1048576,1) . " MB";
if ($filesize>=1073741824 && $filesize<1099511627776)
RETURN number_format($filesize/1073741824,2) . " GB";
if ($filesize>=1099511627776)
RETURN number_format($filesize/1099511627776,2) . " TB";
if ($filesize>=1125899906842624) //Currently, PB won't show due to PHP limitations
RETURN number_format($filesize/1125899906842624,3) . " PB";
}

?>
<html>
<head>
<title><?php echo $name ?> | Deckso Gamez</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo $base ?>/css/tabla.css">
<link rel="stylesheet" type="text/css" href="<?php echo $base ?>/css/style.css">
<Script src="http://code.jquery.com/jquery-2.1.1-rc2.min.js" ></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script src="script.js"></script>
</head>
<body>
<center>
<fieldset style="border: 1px solid #C8C8C8;width: 500;margin: 10;background: #FFF;">
<form style="margin:10px;" action="search.php" method="get">
<input style="width:350px; height:30px; text-align:center; font-family:fantasy" placeholder="Nombre de cancion o artista" type="text" name="id" id="buscar">
<input style="width:100px" type="submit" class="btn btn-success" value="Buscar">
</form>
</fieldset>
</center>
<div class="container-main">
aki
<h3><?php echo $name ?></h3>
<p><?php echo bytes2english($tamaño); ?> </p>

<object width="100%" height="24" type="application/x-shockwave-flash" data="<?php echo $base ?>player/player.swf">
<param name="movie" value="<?php echo $base ?>player/player.swf" />
<param name="flashvars" value="file=upload/<?php echo $url ?>?theme=light&autostart=true&screencolor=000000&b ackcolor=000000&frontcolor=ffffff&lightcolor=0774a f">
<param name="wmode" value="transparent" />
<param name="allowfullscreen" value="true"/>
<param name="allowScriptAccess" value="always" />
</object><br />

<center><a href="<?php echo $base ?>download?file=<?php echo $enlace ?>"><input type="image" src="<?php echo $base ?>imagenes/descarga-boton.png" /></a></center>
</div>



<p><a href="download.php?file=$url">prueba</a></p>






<center><table class="tbl1" cellpadding="2" cellspacing="1" width="500">
<tbody><tr class="hdr"><td colspan="2"><a href="/">Archivos subidos</a></td></tr>
<?php
$query = mysql_query("SELECT * FROM archivos ORDER BY ID DESC LIMIT 10");
while($row = mysql_fetch_assoc($query))
{

$id = $row['ID'];
$name = $row['Name'];
$tam = $row['Tam'];
$mb = bytes2english($tam);
//echo "<tr><td><a href='file.php?id=$id'>$name</a></td><td width='1%' nowrap='' align='right'> $mb </td></tr>";


echo "<tr><td><a href='download.php?file=$id'>$name</a></td><td width='1%' nowrap='' align='right'> $mb </td></tr>";
}


?>
</tbody></table></center>
</body>
</html>

upload.php
<?php

include('config.php');

// extenciones permitidas para subir
$allowedExts = array("mp3","MP3");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);

//checar si la extencion es valida
// subir al folder
//echo '0' si ay error
if ((($_FILES["file"]["type"] == "audio/mp3")
|| ($_FILES["file"]["type"] == "audio/MP3"))
&& in_array($extension, $allowedExts)) {
if ($_FILES["file"]["error"] > 0) {
echo "0";
} else {
$fileName = $_FILES["file"]["name"];
$fileType = $_FILES["file"]["type"];
$fileSize = $_FILES["file"]["size"];
$urlid = rand(10000,90000);
$urlid2 = rand(10000000000000000,900000000000000000);
$target = "upload/";
move_uploaded_file($_FILES["file"]["tmp_name"], $target. $urlid2. ".mp3" );
$url = "$urlid2.mp3";
mysql_query("INSERT INTO archivos VALUE ('$urlid', '$fileName', '$url', '$fileType', '$fileSize')");
echo $fileName ."<br> <a href='file?id=$urlid'>Ir al archivo</a> <br />";
}
} else {
echo "0";
}
  #2 (permalink)  
Antiguo 10/03/2015, 08:37
 
Fecha de Ingreso: marzo-2009
Mensajes: 117
Antigüedad: 15 años, 1 mes
Puntos: 2
Respuesta: upload me limita a 2mb

escribo esta parte aqui por que no me deja en una sola pregunta

cuando intento cargar un mp3 de mas de 2mb me muestra el siguente mensaje que esta en un script.js (selecciona archivos de audio mp3)


$(function(){


$('#myForm').ajaxForm({
beforeSend:function(){
$(".progress").show();
},
uploadProgress:function(event,position,total,perce ntComplete){
$(".progress-bar").width(percentComplete+'%');
$(".sr-only").html(percentComplete+'%');
},
success:function(){
$(".progress").hide();
},
complete:function(response){
if(response.responseText=='0')
$(".error").html("Error: Selecciona archivos de audio mp3");
else
$(".image").html("Archivo subido: "+response.responseText+" ");

}
});


$(".progress").hide();
});
  #3 (permalink)  
Antiguo 10/03/2015, 08:38
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 9 meses
Puntos: 379
Respuesta: upload me limita a 2mb

Que error te envía cuando intentas subir esos archivos ?
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.
  #4 (permalink)  
Antiguo 10/03/2015, 09:13
Avatar de lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 10 años, 8 meses
Puntos: 401
Respuesta: upload me limita a 2mb

Abre tu php.ini. Si no tienes, lo creas. Pega esto....
Código php.ini:
Ver original
  1. ; Maximum allowed size for uploaded files.
  2. upload_max_filesize = 10M

Si te sigue sin funcionar o te da errores, vamos a forzar con .htacces. Añade esto:
Código Apache:
Ver original
  1. #set max upload file size
  2. php_value upload_max_filesize 10M
  3.  
  4. #set max post size
  5. php_value post_max_size 10M
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-

Etiquetas: html, mysql, select, tabla, upload
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:02.