This is a discussion on how upload files within the PHP Language forums, part of the PHP Programming Forums category; how can i submit files in php. i have created one file index.html which contains following code <html&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
how can i submit files in php. i have created one file index.html which
contains following code <html> <head> <title> File Upload Demo </title> </head> <body> <form method="post" action="upload.php" type="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="300000"> <input type="file" name="userfile"> <br><br><br> <input type="submit" name=submit value="Upload"> </form> </body> </html> i have created file upload.php and written folllowing code in this file echo "file name on client machine : " . $_FILES["userfile"]["name"] . "<br>"; 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"] . "<br>"; echo "error in uploading file is : " . $_FILES["userfile"]["error"] . "<br>"; 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 |
|
|||
|
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"> ^^^^^^^ "vishal" <vishal_panjabi@yahoo.co.in> wrote in message news:1113638414.474099.70820@z14g2000cwz.googlegro ups.com... > how can i submit files in php. i have created one file index.html which > contains following code > > <html> > <head> > <title> > File Upload Demo > </title> > </head> > <body> > <form method="post" action="upload.php" type="multipart/form-data"> > <input type="hidden" name="MAX_FILE_SIZE" value="300000"> > <input type="file" name="userfile"> > <br><br><br> > <input type="submit" name=submit value="Upload"> > </form> > </body> > </html> > > > i have created file upload.php and written folllowing code in this file > > echo "file name on client machine : " . $_FILES["userfile"]["name"] . > "<br>"; > 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"] . > "<br>"; > echo "error in uploading file is : " . $_FILES["userfile"]["error"] . > "<br>"; > > > 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 > |
|
|||
|
After you submit the form try to print_r($_FILES), that wil help you!
http://www.DevPlug.com --Connecting Developers Posted from: http://www.devplug.com/ftopic{TOPIC_ID}.htm |
|
|||
|
message unavalaible
http://www.DevPlug.com --Connecting Developers Posted from: http://www.devplug.com/ftopic22244.htm |