Podríais hacer un vistazo a este código, a ver si me sabéis decir que deberia cambiar.
Me sale este error:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\Archivos de programa\EasyPHP-DevServer-14.1VC9\data\localweb\scripts\premo\EmpCrear.php on line 71
Tipo archivo (MIME formato):
Peso: bytes.
Muchas gracias!
A continuación hay el código del formulario y el que hace la acción:
CODIGO: EmpFrmCreacion.php
Código PHP:
Ver original
<center> <FORM enctype="multipart/form-data" method="post" action="EmpCrear.php"> Archivo: <INPUT type="file" name="archivo" size="30"> <table align="center" bgcolor="#A9E2F3"> <tr> <tr> <tr> <tr> <tr> <th colspan="3"> <FONT SIZE=6>New RFQ:</font></th> </tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <th>IdRFQ</th> <td colspan="3"> <input type="text" name="txtidrfq" size="9" /> <th>Data</th> <td colspan="3"> <input type="text" name="txtdata" size="9" /> </td> <th>Project Part Number</th> <td colspan="3"> <input type="text" name="txtproject_part_nombre" size="20" /> </td> <th>Customer</th> <td colspan="3"> <input type="text" name="txtcustomer" size="25"/></td> <th>Category</th> <td colspan="3"> <input type="text" name="txtcategoria" size="20" /> </td> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <th>RM Part Number</th> <td colspan="3"> <input type="text" name="txtRM_part_number" size="23" /> </td> <th>Suppliers</th> <td colspan="3"> <input type="text" name="txtsupplier" size="20" /> </td> <th>Price</th> <td colspan="3"> <input type="text" name="txtprice" size="20" /> </td> <th>Cry2</th> <td colspan="3"> <input type="text" name="txtcry2" size="5" /> </td> <th>MOQ</th> <td colspan="3"> <input type="text" name="txtmoq" size="20" /> </td> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <th>Volume</th> <td colspan="3"> <input type="text" name="txtvolume" size="23" /> </td> <th>Delivery time</th> <td colspan="3"> <input type="text" name="txtdelivery_time" size="20" /> </td> <th>Investment</th> <td colspan="3"> <input type="text" name="txtinvestment" size="25" /> </td> <th>Cry</th> <td colspan="3"> <input type="text" name="txtcry" size="5" /> </td> <th>Timing</th> <td colspan="3"> <input type="text" name="txttiming" size="20" /> </td> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <tr> <th>Responsible</th> <td colspan="3"> <input type="text" name="txtresponisble" size="23" /> </td> <th>Incoterms</th> <td colspan="3"> <input type="text" name="txtincoterms" size="25" /> </td> <th>Comments</th> <td colspan="3"> <input type="text" name="txtcomments" size="25" /> </td> </tr> <tr> <td align="right"colspan="20" > <INPUT type="submit" name="submit" value="SEND"> </td> </tr> </table> </form>
CODIGO: EmpCrear.php
Código PHP:
Ver original
<?php require_once ('../conexion.inc.php'); //Primero, arranca el bloque PHP y checkea si el archivo tiene nombre. Si no fue asi, te remite de nuevo al formulario de inserción: // No se comprueba aqui si se ha subido correctamente. header("location: EmpFrmCreacion.php?proceso=falta_indicar_fichero"); //o como se llame el formulario .. exit; } // archivo temporal (ruta y nombre). $binario_nombre_temporal=$_FILES['archivo']['tmp_name']; // leer del archvio temporal .. el binario subido. // "rb" para Windows .. Linux parece q con "r" sobra ... $archivo_binario = addslashes(fread(fopen($binario_nombre_temporal, "rb"), filesize($binario_nombre_temporal))); // Obtener del array FILES (superglobal) los datos del binario .. nombre, tabamo y tipo. $archivo_nombre=$_FILES['archivo']['name']; $archivo_peso=$_FILES['archivo']['size']; $archivo_tipo=$_FILES['archivo']['type']; $IdRFQ = $_POST['txtidrfq']; $Data = $_POST['txtdata']; $Suppliers = $_POST['txtsupplier']; $Price = $_POST['txtprice']; $Cry2 = $_POST['txtcry2']; $MOQ = $_POST['txtmoq']; $Volume = $_POST['txtvolume']; $Investment = $_POST['txtinvestment']; $Cry = $_POST['txtcry']; $Timing = $_POST['txttiming']; $Incoterms = $_POST['txtincoterms']; $Comments = $_POST['txtcomments']; $q1= "INSERT INTO rfq (idrfq, data, suppliers, price, cry2, moq, volume, investment, timing, cry, incoterms) archivos (id, archivo_binario, archivo_nombre, archivo_peso, archivo_tipo) values ('$IdRFQ','$Data', '$Suppliers', '$Price', '$Cry2', '$MOQ', '$Volume', '$Investment', '$Timing', '$Cry', '$Incoterms', '$archivo_binario', '$archivo_nombre', '$archivo_peso', '$archivo_tipo')"; echo "<br> Nombre archivo: ".$registro['archivo_nombre'].""; echo "<br> Tipo archivo (MIME formato): ".$registro['archivo_tipo'].""; echo "<br> Peso: ".$registro['archivo_peso']." bytes.<br><br>"; ?>