I'm a complete newbie in PHP, and can't find anything concrete to help on this!
Here it is:
- I upload a file, and after that I want php returning the link or path of the file uploaded.
How and where can I include that part on my upload code?
This is the code that processes the upload:
Sorry for my english.
Thanks in advance
Here it is:
- I upload a file, and after that I want php returning the link or path of the file uploaded.
How and where can I include that part on my upload code?
This is the code that processes the upload:
PHP:
<?php
// propriedades do ficheiro
$name = $_FILES["userfile"]["name"];
$type = $_FILES["userfile"]["type"];
$size = $_FILES["userfile"]["size"];
$temp = $_FILES["userfile"]["tmp_name"];
$error = $_FILES["userfile"]["error"];
if ($error > 0)
die ("Ocorreu um erro! Código $error.");
else
{
if ($type == "image/jpg" || $size > 500000) //condicoes para o ficheiro
{
die("Esse formato não é permitido ou tamanho não permitido");
}
else
{
move_uploaded_file($temp,"uploaded/".$name); //move o ficheiro completo para a pasta uploaded
echo "Upload completo!";
}
}
?>
Sorry for my english.
Thanks in advance
