Jump to content

php upload files em txt


rasteiras
 Share

Recommended Posts

Alguem me consegue explicar porque não consigo fazer o upoad de um arquivo txt por favor?

index.html

<div id="menu">
<form enctype="multipart/form-data" action="upload.php" method="post">
    Arquivo <input type="file" name="arquivo"size="20"><br/>
    <input type="submit" value="Enviar arquivo">
</form>
</div>

upload.php

<?php include('includes/connect.php');


$name = $_FILES['arquivo']['name'];
$type = $_FILES['arquivo']['type'];
$size = $_FILES['arquivo']['size'];
$temp = $_FILES['arquivo']['tmp_name'];
$error=$_FILES['arquivo']['error'];

 if($error== 0) {

$pasta='Formatos/uploads';
$upload= move_uploaded_file($temp,$pasta.$name);
}
?>
Link to comment
Share on other sites

1º mete o código sempre dentro das tags do geshi

2º altera o teu código da seguinte forma e diz o que te é apresentado

<?php
include('includes/connect.php');

$name = $_FILES['arquivo']['name'];
$type = $_FILES['arquivo']['type'];
$size = $_FILES['arquivo']['size'];
$temp = $_FILES['arquivo']['tmp_name'];
$error=$_FILES['arquivo']['error'];

print_r($_FILES);

if($error== 0) {
 $pasta='Formatos/uploads';
 $upload= move_uploaded_file($temp,$pasta.$name);
}
?>
Edited by HappyHippyHippo
IRC : sim, é algo que ainda existe >> #p@p
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.