Hello, this may be a stupid question, but im trying to make an upload
from a form with the form plugin (excelent btw), the form data is sent
to a DB through a php script. Here is the form:

<form action="upload_contrib.php" method="post" enctype="multipart/
form-data" id="form_contribs">
                <div style="height:60px"></div>
                <span class="txt">Nombre de la imagen:</span><br />
                <input name="img_uploader" type="text" class="large"
id="img_uploader" />
                <div id="separador10"></div>
                <span class="txt">Descripci&oacute;n:</span><br />
                <textarea name="img_coment" cols="" rows=""
id="img_coment"></textarea>
                <div id="separador10"></div>
                <div>
                  <span class="txt" style="float:left; width:100px">Tu
nick:</span>
                  <span class="txt" style="float:left; width:100px;
padding-left:5px">Tu correo:</span>
                    <div style="clear:both"></div>
                    <input name="img_nick" type="text" class="short"
id="img_nick" />
                    <input name="img_mail" type="text" class="short"
id="img_mail" style="padding-left:5px" />
                </div>
                <div id="separador10"></div>
                <span class="txt">Buscar imagen:</span>
                <input name="img_name" type="file" />
                <input name="img_ip" type="hidden" id="img_ip"
value="<?php echo $ip; ?>" />
                        <input name="img_host" type="hidden" id="img_host" 
value="<?
php echo $servidor; ?>" />
                <input name="img_gal" type="hidden" id="img_gal"
value="<?php echo $contribs_tipo; ?>" />
                <input name="uploadResponseType" type="hidden"
id="uploadResponseType" value="html" />
                <input type="hidden" name="MAX_FILE_SIZE"
value="100000" />
                <div id="separador30"></div>
                <input name="enviar" type="submit" class="button"
id="enviar_formcontribs" value="" />
            </form>

The php script that sends the data (upload_contrib.php):

cargar_contrib($_POST["img_uploader"],$_POST["img_nick"],
$_POST["img_coment"],$_POST["img_mail"],$_POST["img_gal"],
$_POST["img_ip"],$_POST["img_host"]);
echo "si";

The jquery script to process the form:

$('#form_contribs').ajaxForm({
        beforeSubmit: function(a,f,o) {
            o.dataType = $('#uploadResponseType')[0].value;
            $('#uploadOutput').html('Submitting...');
        },
        success: function(data) {
            var $out = $('#uploadOutput');
            $out.html('Form success handler received: <strong>' +
typeof data + '</strong>');
            if (typeof data == 'object' && data.nodeType)
                data = elementToString(data.documentElement, true);
            else if (typeof data == 'object')
                data = objToString(data);
            $out.append('<div><pre>'+ data +'</pre></div>');
                        alert(data);
        }
    });

I'm sorry....but nothing happens, when I submit the form, the response
div shows this:

insert into xxxxxxxxx
(img_name,img_uploader,img_nick,img_coment,img_mail,img_gal,img_date_up,img_time_up,img_ip,img_host)
values ('','nombreq','nick','asdfa
afafaf','correo','2',NOW(),NOW(),'','xxxxxxxxxxxx')

but nothing from the file field, and of course, the data is writen to
the DB, but no file uploaded.

Please advise. Thanks.

Reply via email to