By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,708 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

image won't upload - i've checked form a dozen times

P: n/a
I've the form you see below, which is supposed to upload an image. I
expect the image name as a var to be $uploadedFile. In the receiving
function, I've this code:
global $uploadedFile, $uploadedFile_size, $uploadedFile_name;
echo "here is the file name: $uploadedFile, $uploadedFile_size,
$uploadedFile_name; <hr> ";
$uploadedFile_name =
$formatTextObject->processFileName($uploadedFile_name);
$uploadedFile_name = htmlspecialchars($uploadedFile_name);

The line where I echo things out is just for debugging. I get the
first 5 words, but no vars, nothing, no globals of that name are in
global space. Below is the form. What am I missing?

>>>>>>>>>>>>>>>>>>>>>>>>>>>


<form method="post" action="/mcControlPanel.php"
enctype="multipart/form-data" class="mcForm">

<input id="inputId1" type="hidden"
name="formInputs[formSecurityRating]" value="associate"
class="hiddenInput">

<div class="formElement">
Upload an image:
<input type="file" name="uploadedFile"><input type="hidden"
name="uploadType" value="image"></div>

<div class="formElement">
Type an easy to read name (as opposed to the file name) for this
image:
<div class="inputBoxTitle"><input id="inputId2" type="text"
name="formInputs[cbHeadline]" value="" class="textInput">
</div></div>

<div class="formElement">
Type a brief description:<br>
<textarea id="inputId3" name="formInputs[cbMainContent]"
class="textareaInput"></textarea>
<p>HTML into symbols? <input type="checkbox"
name="formInputs[usingHtml]" value="y" class="textareaCheckbox"></p>

</div>


<input type="hidden" name="formInputs[cbWhichType]" value="imageInfo">

<input type="hidden" name="choiceMade" value="standardImageUpload">
<input type="hidden" name="fileName" value="">
<input type="submit" value="Click here when done" class="submitInput">
</form></div>
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
I've now checked all the vars that I can think of. I'm working with a
server running RH 9, PHP 4.2.3. YOu can see the whole form below.
After upload, all the vars are empty, including $_FILES array. The
image I'm trying to upload is 87k .

What am I missing folks?


<div class="onePanel">
<form method="post" action="/mcControlPanel.php"
enctype="multipart/form-data" class="mcForm"><input id="inputId1"
type="hidden" name="formInputs[formSecurityRating]" value="associate"
class="hiddenInput">
<div class="formElement">
Upload an image:
<input type="file" name="uploadedFile"><input type="hidden"
name="uploadType" value="image"></div>

<input type="hidden" name="formInputs[cbWhichType]" value="imageInfo">
<input type="hidden" name="choiceMade" value="standardImageUpload">
<input type="hidden" name="fileName" value="">
<input type="submit" value="Click here when done" class="submitInput">
</form></div>



lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
I've the form you see below, which is supposed to upload an image. I
expect the image name as a var to be $uploadedFile. In the receiving
function, I've this code:
global $uploadedFile, $uploadedFile_size, $uploadedFile_name;
echo "here is the file name: $uploadedFile, $uploadedFile_size,
$uploadedFile_name; <hr> ";
$uploadedFile_name =
$formatTextObject->processFileName($uploadedFile_name);
$uploadedFile_name = htmlspecialchars($uploadedFile_name);

The line where I echo things out is just for debugging. I get the
first 5 words, but no vars, nothing, no globals of that name are in
global space. Below is the form. What am I missing?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>


<form method="post" action="/mcControlPanel.php"
enctype="multipart/form-data" class="mcForm">

<input id="inputId1" type="hidden"
name="formInputs[formSecurityRating]" value="associate"
class="hiddenInput">

<div class="formElement">
Upload an image:
<input type="file" name="uploadedFile"><input type="hidden"
name="uploadType" value="image"></div>

<div class="formElement">
Type an easy to read name (as opposed to the file name) for this
image:
<div class="inputBoxTitle"><input id="inputId2" type="text"
name="formInputs[cbHeadline]" value="" class="textInput">
</div></div>

<div class="formElement">
Type a brief description:<br>
<textarea id="inputId3" name="formInputs[cbMainContent]"
class="textareaInput"></textarea>
<p>HTML into symbols? <input type="checkbox"
name="formInputs[usingHtml]" value="y" class="textareaCheckbox"></p>

</div>


<input type="hidden" name="formInputs[cbWhichType]" value="imageInfo">

<input type="hidden" name="choiceMade" value="standardImageUpload">
<input type="hidden" name="fileName" value="">
<input type="submit" value="Click here when done" class="submitInput">
</form></div>

Jul 17 '05 #2

P: n/a
lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
I've the form you see below, which is supposed to upload an image. I
expect the image name as a var to be $uploadedFile.

<snip>

Add the following 2 line in the beginning of your script and then retry.

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #3

P: n/a
ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<ab**************************@posting.google. com>...
lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
I've the form you see below, which is supposed to upload an image. I
expect the image name as a var to be $uploadedFile.

<snip>

Add the following 2 line in the beginning of your script and then retry.

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>


I switched to a different web server and I tried your advice. Now the
file name appears (see bottom line below), though the image is still
not uploading. This server runs BSD and PHP 4.0.6. Can you think of
any reason an older version of PHP might see the file name, while the
other server, running 4.2.3 showed nothing?








Warning: Undefined variable: _POST in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 648

Warning: Undefined variable: _GET in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 650

Warning: Undefined variable: _ENV in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 652

Warning: Undefined variable: _SERVER in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 654

Warning: Undefined variable: _COOKIE in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 656

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 638

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 640

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 642

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 644

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 646

Warning: Undefined variable: _POST in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 648

Warning: Undefined variable: _GET in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 650

Warning: Undefined variable: _ENV in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 652

Warning: Undefined variable: _SERVER in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 654

Warning: Undefined variable: _COOKIE in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 656

Warning: Cannot send session cache limiter - headers already sent
(output started at /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php:638)
in /usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McSessionInfo.php
on line 29

Warning: Undefined index: McUsers in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 90

Warning: Undefined index: controlPanelEventsMiddle in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 638

Warning: Undefined index: controlPanelEventsMiddle in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 640

Warning: Undefined index: controlPanelEventsMiddle in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 642

Warning: Undefined index: controlPanelEventsMiddle in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 644

Warning: Undefined index: controlPanelEventsMiddle in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 646

Warning: Undefined variable: _POST in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 648

Warning: Undefined variable: _GET in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 650

Warning: Undefined variable: _ENV in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 652

Warning: Undefined variable: _SERVER in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 654

Warning: Undefined variable: _COOKIE in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 656

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 638

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 640

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 642

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 644

Warning: Undefined index: arrayOfAllAllowedFunctions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 646

Warning: Undefined variable: _POST in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 648

Warning: Undefined variable: _GET in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 650

Warning: Undefined variable: _ENV in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 652

Warning: Undefined variable: _SERVER in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 654

Warning: Undefined variable: _COOKIE in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 656

Warning: Undefined index: McUsers in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 90

Warning: Undefined variable: _POST in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
on line 125

Warning: Undefined index: username in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
on line 126

Warning: Undefined variable: _POST in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
on line 127

Warning: Undefined index: password in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McUsers.php
on line 128

Warning: Undefined index: McTransactions in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 90

Warning: Undefined index: McFormatText in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppKernel/McControllerForAll.php
on line 90
here is the file name: /var/tmp//phpt2tDZZ, 53264, corso1a.jpg;
Warning: Undefined variable: absolutePath in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppExtras/standardImageUpload.php
on line 43
Jul 17 '05 #4

P: n/a
lk******@geocities.com (lawrence) wrote in message news:<da*************************@posting.google.c om>...
<snip>

Add the following 2 line in the beginning of your script and then retry.

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
I switched to a different web server and I tried your advice. Now the
file name appears (see bottom line below), though the image is still
not uploading. This server runs BSD and PHP 4.0.6. Can you think of
any reason an older version of PHP might see the file name, while the
other server, running 4.2.3 showed nothing?


http://in2.php.net/reserved.variables :
Since PHP 4.1.0, the preferred method for retrieving
external variables is with the superglobals mentioned
below. Before this time, people relied on either
register_globals or the long predefined PHP arrays
($HTTP_*_VARS). As of PHP 5.0.0, the long PHP predefined
variable arrays may be disabled with the register_long_arrays
directive.

here is the file name: /var/tmp//phpt2tDZZ, 53264, corso1a.jpg;
Warning: Undefined variable: absolutePath in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppExtras/standardImageUpload.php
on line 43

Few other guidelines:
1. Always enable full error reporting
2. Learn the art of debugging. Can be done with print_r($GLOBALS)
easily on >=4.1.0 for example.
3. Try using Google <http://www.google.com/search?q=php+upload> and
manual <http://in.php.net/features.file-upload>

And here, it seems the file is getting uploaded to the upload
directory (usually /tmp) as expected.

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #5

P: n/a
ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message
I switched to a different web server and I tried your advice. Now the
file name appears (see bottom line below), though the image is still
not uploading. This server runs BSD and PHP 4.0.6. Can you think of
any reason an older version of PHP might see the file name, while the
other server, running 4.2.3 showed nothing?


http://in2.php.net/reserved.variables :
Since PHP 4.1.0, the preferred method for retrieving
external variables is with the superglobals mentioned
below. Before this time, people relied on either
register_globals or the long predefined PHP arrays
($HTTP_*_VARS). As of PHP 5.0.0, the long PHP predefined
variable arrays may be disabled with the register_long_arrays
directive.

here is the file name: /var/tmp//phpt2tDZZ, 53264, corso1a.jpg;
Warning: Undefined variable: absolutePath in
/usr/local/www/vhosts/publicpen.com/htdocs/campGarden/ppExtras/standardImageUpload.php
on line 43

Few other guidelines:
1. Always enable full error reporting
2. Learn the art of debugging. Can be done with print_r($GLOBALS)
easily on >=4.1.0 for example.
3. Try using Google <http://www.google.com/search?q=php+upload> and
manual <http://in.php.net/features.file-upload>

And here, it seems the file is getting uploaded to the upload
directory (usually /tmp) as expected.


Thanks much for the tips. I hope I didn't waste your time. I did, of
course, use print_r(), I thought that was in the example I posted, but
perhaps not.

But I'm still having the same trouble.

You'll admit that print_r() isn't much use if the variable isn't
registered. I'm getting nothing in $_POST and nothing in
$HTTP_POST_VARS.

I'm debuging on two machines. The BSD server running PHP 4.06 works
fine, the images upload and the variables show up. But on the server,
running RH Linux and PHP 4.2.3 I still don't get anything at all. I
assume it's something in the ini file but I'm not sure what.

By the way, I do respect the time of the people who here answer
questions and so I always first run a search at groups.google.com
before I post a question. But I didn't see anything in the archives
that explained a possible difference between two web servers, with
setups similar to what I'm running.
Jul 17 '05 #6

P: n/a
lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
<snip>
You'll admit that print_r() isn't much use if the variable isn't
registered. I'm getting nothing in $_POST and nothing in
$HTTP_POST_VARS.
May be the IE bug <http://groups.google.com/groups?selm=abc4d8b8.0405032154.67ac69f0%40posting .google.com>
??

I'm debuging on two machines. The BSD server running PHP 4.06 works
fine, the images upload and the variables show up. But on the server,
running RH Linux and PHP 4.2.3 I still don't get anything at all. I
assume it's something in the ini file but I'm not sure what.


Couldn't you compare the two ini files?

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.