how upload files

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&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2005
vishal
 
Posts: n/a
Default how upload files

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

Reply With Quote
  #2 (permalink)  
Old 04-16-2005
Duyet The Vo
 
Posts: n/a
Default 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">
^^^^^^^

"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
>



Reply With Quote
  #3 (permalink)  
Old 04-18-2005
rovisoft
 
Posts: n/a
Default re:how upload files

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
Reply With Quote
  #4 (permalink)  
Old 04-18-2005
rovisoft
 
Posts: n/a
Default re:how upload files

message unavalaible

http://www.DevPlug.com --Connecting Developers
Posted from: http://www.devplug.com/ftopic22244.htm
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:18 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0