Forums

PHP

This topic is locked

upload -enctype

Posted 28 Oct 2002 11:16:03
1
has voted
28 Oct 2002 11:16:03 Alessio Bottaini posted:
Hi
I have a some programs for uploading file but they work by Mozilla and not by Explorer.By Explorer the programs don't pass the variables in the form...
what is wrong?

At first the web page shows you the button with which you can choose the file you want for uploading it,and you have another button for uploading it.
Ok,now I select the file I want to upload and I press the button "upload" but the only thing happends is that the web page reload itself (and I have to select again the file)...
I have another exemple:
if I write

..... <form method ="post" enctype="multipart/form-data" action="fileX.php">
<input type="FILE" name="userfile">...
...<input text="text" name="pass" value="something">.......</form>...

In the file "fileX" the variable $pass is empty.
Without "enctype" in the form the variable $pass in the file "fileX" has the right value "something".
I suppose the problem is in the firewall but I have not idea where to look for.
I'm sorry for my English <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thank you for your help!
Ciao!




Here is for example one small program for uploading.


&lt;?php
$archive_dir="./Upload";

function upload_form()
{
global $PHP_SELF;
?&gt;

&lt;form method ="post" enctype="multipart/form-data" action="&lt;? echo $PHP_SELF?&gt;"&gt;
&lt;input type="hidden" name="action" value="upload"&gt;
Upload file!
&lt;input type="FILE" name="userfile"&gt;
&lt;input type="submit" name="submit" value="upload"&gt;
&lt;/form&gt;

&lt;?
}

function upload_file ()
{

global $userfile, $userfile_name, $userfile_size, $userfile_type, $archive_dir, $WINDIR;

if (isset($WINDIR)) $userfile=str_replace("\\\\","\\",$userfile);
$filename=basename($userfile_name);
if ($userfile_size&lt;=0) die ("$filename is empty.";
if (!@copy($userfile,"$archive_dir/$filename")
die ("Can t copy $userfile_name to $filename.";

if (!isset($WINDIR) && !@unlink($userfile))
die ("Can't delete the file $userfile_name";

echo"$filename has been successfully uploaded.&lt;br&gt;";
echo" Filesize: . number:format($userfile_size) . &lt;br&gt;";
echo"Filetype: $userfile_type&lt;br&gt;";
}
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;/head&gt;

&lt;body bgcolor="#FFFFFF" text="#000000"&gt;
&lt;?
if ($action=='upload') upload_file();
else upload_form();
?&gt;
&lt;/body&gt;
&lt;/html&gt;
<pre id=code><font face=courier size=2 id=code> </font id=code></pre id=code>

Edited by - alessio.bottaini on 29 Oct 2002 17:01:14

Replies

Replied 29 Oct 2002 12:05:22
29 Oct 2002 12:05:22 Aurel Sorin Cirstoiu replied:
Hello,

Please give us more details about this issue.

-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
-----------------------

Reply to this topic