Código PHP:
<?php include ('conex.php'); ?>
<html>
<title>Subida múltiple de archivos 1</title>
<head>
<script src="jquery/jquery.form.js" type="text/javascript"></script>
<script src="jquery/jquery.js" type="text/javascript"></script>
<script src="jquery/jquery.MetaData.js" type="text/javascript"></script>
<script src="jquery/jquery.MultiFile.js" type="text/javascript"></script>
<script src="jquery/jquery.MultiFile.pack.js" type="text/javascript"></script>
<script src="jquery/jquery.validate.js" type="text/javascript"></script>
</head>
<body>
<form enctype="multipart/form-data" name="upload1.php" method="post">
<input type="file" name="archivito[]" class="multi
{accept:"gif|jpg", max:3, STRING:{
remove:"Remover",
selected:"Selecionado: $file",
denied:"Invalido arquivo de tipo $ext!",
duplicate:"Arquivo ja selecionado:\n$file!"}}" />
<input type="submit" name="enviar" value="Enviar archivo">
</form>
</body>
</html>
<?php
if($_POST["enviar"]){
$archivo= $_FILES["archivito"]["tmp_name"];
$tamanio= $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
$titulo = $_POST["titulo"];
$fp = fopen($archivo, "rb");
$contenido= fread($fp, $tamanio);
$contenido= addslashes($contenido);
fclose($fp);
$_POST[nombre] = "'" . implode(',', $_POST['nombre']) . "'";
$_POST[archivito] = "'" . implode(',', $_POST['archivito']) . "'";
$_POST[tipo] = "'" . implode(',', $_POST['tipo']) . "'";
$sql="insert into archivos(nombre,contenido,tipo)values
('$_POST[nombre]','$_POST[contenido]','$_POST[tipo]')";
if ($result=mysql_query ($sql,$link)){echo '<script language= "Javascript"> alert("Archivo guardado correctamente");</script>';}
else{echo 'error:'.mysql_error($link);}
}
Estos son los errores que me salen:
Código HTML:
Ver original
Warning: fopen() expects parameter 1 to be string, array given in C:\AppServ\www\UPLOAD_MULTIPLE\upload1.php on line 36 Warning: fread(): supplied argument is not a valid stream resource in C:\AppServ\www\UPLOAD_MULTIPLE\upload1.php on line 37 Warning: fclose(): supplied argument is not a valid stream resource in C:\AppServ\www\UPLOAD_MULTIPLE\upload1.php on line 39 Warning: implode() [function.implode]: Bad arguments. in C:\AppServ\www\UPLOAD_MULTIPLE\upload1.php on line 40 Warning: implode() [function.implode]: Bad arguments. in C:\AppServ\www\UPLOAD_MULTIPLE\upload1.php on line 41 Warning: implode() [function.implode]: Bad arguments. in C:\AppServ\www\UPLOAD_MULTIPLE\upload1.php on line 42