...

View Full Version : strange upload problem



xiaodao
11-08-2006, 04:19 AM
<table width="100%" align="center" border="0" cellspacing="1" cellpadding="4">
<form action="/news/admin/organisation.php" enctype="multipart/form-data" method="post" name="" >
<tr id="cat">
<td class="tblhead" colspan="2"><b>Add Organisation</b></td>
</tr>
<tr class="firstalt" nowrap>
<td valign="top">Attachment:</td>
<td id="upid"><input class="fileinput" type="file" name="attachment1" size="30"></td>
</tr>
<tr class="secondalt" nowrap>
<td valign="top">Attachment:</td>
<td id="upid"><input class="fileinput" type="file" name="attachment2" size="30"></td>
</tr>
<tr class="firstalt" nowrap>
<td valign="top">Attachment:</td>
<td id="upid"><input class="fileinput" type="file" name="attachment3" size="30"></td>
</tr>
<tr class="secondalt" nowrap>
<td valign="top">Attachment:</td>
<td id="upid"><input class="fileinput" type="file" name="attachment4" size="30"></td>
</tr>
<tr class="firstalt" nowrap>
<td valign="top">Attachment:</td>
<td id="upid"><input class="fileinput" type="file" name="attachment5" size="30"></td>
</tr>
<input type="hidden" name="action" value="addorg">
<input type="hidden" name="id" value="2">
<tr class="tblhead">
<td colspan="2" align="center">
<input class="formbutton" accesskey="y" type="submit" name="submit" value="Submit" >
<input class="formbutton" accesskey="r" type="reset" name="" value="Reset" >
</td></tr>
</form>
</table>

above is my upload script, however when i upload, i cannot see anything


if($_POST['action']=="addorg"){
$newsid=$_POST['id'];
print_r($_FILES['attachment1']);
echo count($_FILES['attachment1']);
}

can anyone help me?

CFMaBiSmAd
11-08-2006, 04:45 AM
Assuming that uploads are enabled to begin with, if the $_FILES variable is null, the most likely reason is that the upload file size exceeds the POST_MAX_SIZE directive in php.ini.

xiaodao
11-08-2006, 04:52 AM
hi, the size of picture only 7kb, i think problem lies elsewhere

CFMaBiSmAd
11-08-2006, 05:06 AM
Your code works on my test system, so there are no typo's that prevent it from working.

xiaodao
11-08-2006, 05:42 AM
hi, what is the result shown on your system, i am getting empty array

CFMaBiSmAd
11-08-2006, 06:00 AM
Array ( [name] => myphoto.JPG [type] => image/pjpeg [tmp_name] => C:\WINDOWS\TEMP\php47.tmp [error] => 0 [size] => 1015124 ) 5

Note: If you use the following, it will be formated better and will show all the contents of the $_FILES, not just for one -

echo "<pre>";
print_r($_FILES);
echo "</pre>";This code outputs the following (I only selected a file in the first form field) -

Array
(
[attachment1] => Array
(
[name] => myphoto.JPG
[type] => image/pjpeg
[tmp_name] => C:\WINDOWS\TEMP\php47.tmp
[error] => 0
[size] => 1015124
)

[attachment2] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)

[attachment3] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)

[attachment4] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)

[attachment5] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)

)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum