HELP needed uploading a file
Posted: Sat Apr 28, 2007 2:33 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm using a very simple script to upload files,
see html and php below.
I dont get error msg but the file never gets to my server.
Can you help me on this?Code: Select all
<html><body>
<form enctype="multipart/form-data" action="http://www.usa21.net/testupload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="80000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Enviar Arquivo">
</form>
</body></html>
<html><body>
<!--upload_temp_dir no php.ini ou TMPDIR-->
<?php
// Nas versões anteriores a 4.1.0, $HTTP_POST_FILES deve ser usado ao invés de $_FILES.
// Nas versões anteriores a 4.0.3, use copy() e is_uploaded_file() ao invés move_uploaded_file
$uploaddir = '/uploads/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if ($_FILES['userfile']['size'] > 80000)
print "O arquivo é muito grande";
else if ($_FILES['userfile']['type'] != "image/jpg)
print "OArquivo não é JPG"
else if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
print "O arquivo é valido e foi carregado com sucesso. Aqui esta alguma informação:\n";
print_r($_FILES);
} else {
print "Possivel ataque de upload! Aqui esta alguma informação:\n";
print_r($_FILES);
}
print "</pre>";
?>
<!--
$_FILES['userfile']['name']
O nome original do arquivo no computador do usuário.
$_FILES['userfile']['type']
O tipo mime do arquivo, se o browser deu esta informação. Um exemplo pode ser "image/gif".
$_FILES['userfile']['size']
O tamanho, em bytes, do arquivo.
$_FILES['userfile']['tmp_name']
O nome temporário do arquivo, como foi guardado no servidor.
$_FILES['userfile']['error']
-->
</body></html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]