how upload files

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

how can i submit files in php. i have created one file index.html which
contains following code

File Upload Demo
<form method="post" action="upload.php" type="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
<input type="file"  name="userfile">
<input type="submit" name=submit value="Upload">

i have created file upload.php and written folllowing code in this file

echo "file name on client machine : " . $_FILES["userfile"]["name"] .
    echo "file type is : " . $_FILES["userfile"]["type"] . "<br>";
    echo "file size is : " . $_FILES["userfile"]["size"] . "<br>";
    echo "file name on server is :  " . $_FILES["userfile"]["tmp_name"] .
    echo "error in uploading file is : " . $_FILES["userfile"]["error"] .

but i get blank output wherever i try to print the value of super
global array $_FILES.

thxs for help in advance. pls suggest me where i am wrong

Re: how upload files

You might want to check if things are posted by include the following
at the beginning of upload.php

    phpinfo( INFO_VARIABLES );

This will print a table with all the variable known to PHP. From here
you can see if $_FILES is empty. In your case it is!

You used type iso enctype in the form tag. Type is not a defined attribute
in the FORM-tag.

<form method="post" action="upload.php" enctype="multipart/form-data">

Quoted text here. Click to load it

re:how upload files

After you submit the form try to print_r($_FILES), that wil help you! --Connecting Developers
Posted from: .htm

re:how upload files

message unavalaible --Connecting Developers
Posted from:

Site Timeline