File upload temp file not created!

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
zbm
Forum Newbie
Posts: 5
Joined: Thu Oct 19, 2006 10:58 am

File upload temp file not created!

Post 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!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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" >
...
zbm
Forum Newbie
Posts: 5
Joined: Thu Oct 19, 2006 10:58 am

No temp file upload

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
zbm
Forum Newbie
Posts: 5
Joined: Thu Oct 19, 2006 10:58 am

file post

Post 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
User avatar
ibbo
Forum Commoner
Posts: 51
Joined: Tue Sep 19, 2006 6:20 am

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: No temp file upload

Post 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 (
)
zbm
Forum Newbie
Posts: 5
Joined: Thu Oct 19, 2006 10:58 am

Any Ideas?

Post 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
zbm
Forum Newbie
Posts: 5
Joined: Thu Oct 19, 2006 10:58 am

FIXED!

Post 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
Post Reply