Page 1 of 1

File upload temp file not created!

Posted: Thu Oct 19, 2006 11:12 am
by zbm
This problem has been driving me nuts seeing as how I could not find other people that have had this problem. I am just trying to get file upload working but it seems like nothing is happening from the server end. Tmp files should be deleted right after the request is made but there is nothing in $FILES. I am running Apache 2.2.0 and PHP 5.1.2 on FC 5. My tmp upload directory has apache as owner and I get no errors through php or apache. Apache was on debug error mode and php was on all errors. My code is below:

Code: Select all

<h2>Upload Image</h2>
<p>
<?
if (isset($_POST['name'])) {
	$tmp = $_FILES['image']['tmp_name'];
	echo $tmp.'<br />';
	
}

?>

<form enctype="multipart/form-data" action="./?site=pictures" method="post" >
<input type="hidden" name="MAX_FILE_SIZE" value="1000000"/>
<table>
	<tr>
		<td>Your Name: </td>
		<td><input name="name"/></td>
	</tr>
	<tr>
		<td>A Comment: </td>
		<td><input name="comment"/></td>
	</tr>
	<tr>
		<td>Upload File: </td>
		<td><input type="file" name="image" /></td>
	</tr>
	<tr>
		<td><input type="submit" value="Upload"/></td>
	</tr>
</table>
</form> 
</p>
Thanks for any help!

Posted: Thu Oct 19, 2006 2:25 pm
by volka
Is there anything in $_FILES at all?

Code: Select all

<h2>Upload Image</h2>
<p>
<pre>post: <?php var_export($_POST); ?></pre>
<pre>files: <?php var_export($_FILES); ?></pre>
<?php
if (isset($_POST['name'])) {
        $tmp = $_FILES['image']['tmp_name'];
        echo $tmp.'<br />';
       
}

?>

<form enctype="multipart/form-data" action="./?site=pictures" method="post" >
...

No temp file upload

Posted: Thu Oct 19, 2006 5:16 pm
by zbm
Here is the out put:

post: array (
'MAX_FILE_SIZE' => '1000000',
'name' => 'foo',
'comment' => 'bar',
)

files: array (
)

It really is strange. On uploading a larger file it will hang as if that file is being transfered. Smaller files are quick.

Thanks for the help and any other ideas.

Posted: Thu Oct 19, 2006 5:22 pm
by volka
There should be an error log for the apache server.
Does it contain any error/warning/message that looks like it might be related to the problem?

file post

Posted: Thu Oct 19, 2006 5:39 pm
by zbm
Thats the first place I checked but there is really nothing related. I can get an error if i try to upload a file above the max size so I know the data is posting. I enabled the most verbose settings on php and apache with no success. Think this is a PHP or Apache problem?

Thanks

Posted: Fri Oct 20, 2006 3:28 am
by ibbo
do a print_r($_FILES);

Check the error codes

0 = UPLOAD_ERR_OK
1 = UPLOAD_ERR_INI_SIZE
2 = UPLOAD_ERR_FORM_SIZE
3 = UPLOAD_ERR_PARTIAL
4 = UPLOAD_ERR_NO_FILE

ibbo

Re: No temp file upload

Posted: Fri Oct 20, 2006 4:07 am
by volka
already did a var_export for _POST and _FILES and it came up as
zbm wrote:Here is the out put:

post: array (
'MAX_FILE_SIZE' => '1000000',
'name' => 'foo',
'comment' => 'bar',
)

files: array (
)

Any Ideas?

Posted: Sun Oct 22, 2006 5:20 pm
by zbm
I am at a loss right now for this problem. I am getting no PHP or Apache errors and still nothing in files array. Anyone have any other ideas to try?

Thanks,
Zack

FIXED!

Posted: Mon Oct 23, 2006 1:42 am
by zbm
I installed gallery2 without a problem and when I went back to try my script it worked. I am not sure what the deal was but it worked. Thanks for the help everyone! I guess for anyone else having this mystery problem, try installing gallery.

Thanks