moonorongo
1/29/2015 - 7:01 PM

[upload de archivos] #php

[upload de archivos] #php

<?php
$target_dir = "uploads/";
$target_file = $target_dir .basename($_FILES["fileToUpload"]["name"]);
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)
?>

<html>

<body>
<h1>Upload this</h1>
<form name="form1" action="upload.php" method="POST" enctype="multipart/form-data">
<input type="file" accept="image/*;capture=camera" name="fileToUpload" />
<br /><br />
<button type="submit">Enviar</button>
</form>
</body>
</html>
en php.ini debe estar esto asi
enable_post_data_reading = On

si no $_FILES estara siempre vacio

mas detalles en el post:
http://www.w3schools.com/php/php_file_upload.asp