Moneybag Posted February 25, 2012 at 04:43 AM Report Share #441103 Posted February 25, 2012 at 04:43 AM Boas Tenho o seguinte sistema de upload: index.pxp <html> <head> <title></title> </head> <body> <table border="1" align="left" > <tr><td> <form name="insert_movie" action="insert.php" method="post" id="form1"> <table> <tr><td>Nome: </td><td><input type="text" name="name" /></td></tr> <tr><td><label for="file">Imagem:</label></td><td> <input type="file" name="file-image" /></td></tr> </select></td></tr> <tr><td colspan="2" align="right"><input type="button" value="Limpar" onclick="document.getElementById('form1').reset();"/><input type="submit" value="Inserir" style="width:100px;"/></td></tr> </table> </form> </td></tr> </table> </body> </html> insert.php $imagedir = '../images/cover/'; print "<pre>"; $name_image = $_FILES['file-image']['name']; if (@move_uploaded_file($_FILES['file-image']['tmp_name'], $imagedir . $_FILES['file-image']['name'])) { print "A imagem: <b>$name_image</b> foi carregada com sucesso. \n"; //print_r($_FILES); } else { print "Erro ao fazer upload! Aqui esta alguma informação:\n"; print_r($_FILES['file-image']['error']); echo "<br /> UPLOAD_ERR_OK Value: 0; There is no error, the file uploaded with success. UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini. UPLOAD_ERR_FORM_SIZE Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. UPLOAD_ERR_PARTIAL Value: 3; The uploaded file was only partially uploaded. UPLOAD_ERR_NO_FILE Value: 4; No file was uploaded. UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. UPLOAD_ERR_CANT_WRITE Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0. UPLOAD_ERR_EXTENSION Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0."; } print "</pre>"; Resultado: Não mostra o erro, nem faz upload 😕 Link to comment Share on other sites More sharing options...
brunoais Posted February 25, 2012 at 09:01 AM Report Share #441109 Posted February 25, 2012 at 09:01 AM Vejamos, existe o @type="reset" para input. Não precisas de usar js para isso. Falta indicares o enctype para poderes enviar ficheiros. qq coisa como: "multipart/form-data" (possivelmente n é assim mas é parecido). "[Os jovens da actual geração]não lêem porque não envolve um telecomando que dê para mirar e atirar, não falam porque a trapalhice é rainha e o calão é rei" autor: thoga31 Life is a genetically transmitted disease, induced by sex, with death rate of 100%. Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted February 25, 2012 at 10:24 AM Report Share #441116 Posted February 25, 2012 at 10:24 AM Vejamos, existe o @type="reset" para input. Não precisas de usar js para isso. Falta indicares o enctype para poderes enviar ficheiros. qq coisa como: "multipart/form-data" (possivelmente n é assim mas é parecido). 😕 <form enctype="multipart/form-data" action="insert.php" method="post"> http://www.tizag.com/phpT/fileupload.php IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
Moneybag Posted February 25, 2012 at 05:59 PM Author Report Share #441141 Posted February 25, 2012 at 05:59 PM resolvido, obrigado 😕 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now