473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
6 2357
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Beowulf | last post by:
Hi Guru's, I have a query regarding using PHP to maintain a user profiles list. I want to be able to have a form where users can fill in their profile info (Name, hobbies etc) and attach an...
15
by: lawrence | last post by:
I've been using the following function (yes, it is inelegant, what can I say, I wrote it a long time ago) to upload images. Haven't had a problem with it for at least a year, and I don't recall...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
4
by: DH | last post by:
I have a "file upload form" that works OK, but I have been unsuccessful in my attempt to also resize the uploaded .JPG (if it is too wide), over-writing the original .JPG, and then create and save...
4
by: miarte | last post by:
I have a form to allow the user upload images. The user browse for an image in their computer and click open, th image to be upload is preview on the img tag. The script works fine with IE, but...
0
by: doffer | last post by:
I want to make a portfoliosystem where user can register and get their own portfolio... I've started the developer work, but I'm stuck on the image upload part... I'm experiencing some problems...
49
by: Lauren Wilson | last post by:
Hi folks, Just wondered if, for the sake of clarity, it is permissible to post small image files of an error box along with a text message about a problem with Access?
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
7
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.