phptest-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phptest-users] Re: add question issue


From: Kathleen Ferraro
Subject: Re: [Phptest-users] Re: add question issue
Date: Thu, 18 Jul 2002 16:06:52 -0400

Are you sure the code is right? When I add it my page doesn't load at all (omniweb and explorer).
In the meantime, I'll turn on notices and let you know what happens.

Thanks,
Kathie

On Thursday, July 18, 2002, at 03:40 PM, dj resonance wrote:

Hi again Kathleen,

The problem seems to be that your browser or php or
the webserver (not sure which one) is not passing
$HTTP_POST_FILES to the script.  In my testing, the
variable would be passed, even if it was empty. What
is happening with your script is that the variable is
empty, so the conditional checks are passing.  Try
replacing this part of the code with the text below:

        // else, if a file tried to upload but didn't
work
        } elseif ($HTTP_POST_FILES['image']['error']
!= '4' && isset($HTTP_POST_FILES)) {

            if ($HTTP_POST_FILES['image']['tmp_name']
!= 'none') {

The "&& isset($HTTP_POST_FILES)" part should fail for
you so I'm guessing the code would work.  Also if you
turn on notices in your php.ini file you might see a
warning about $HTTP_POST_FILES being empty.  Let me
know if that works for you.

Thanks,
Brandon


--- Kathleen Ferraro <address@hidden> wrote:
Gladly, Brandon. Here are a couple of scenarios:

1. Added the code you suggested and entered text
without uploading an
image; got this output:

Array ( [skill_level] => English [question] => What
is my favorite color
[answer] => Blue [alt_1] => Red [alt_2] => Yellow
[alt_3] => Violet
[additional_notes] => [required] => 1 [weight] => 1
[MAX_FILE_SIZE] =>
1000000 [description] => [submit] => Submit! ) Array
( )


2. Removed the code and tried to load file without
an image. Got error
the error message

The following error(s) were encountered processing
your submission:
Unknown file upload error


3. Reloaded page to enter text again. Noticed that
when I reloaded the
page (shift reload), the text I had entered cleared
but the error
message that had displayed was still there.

3. Quit and logged in again

4. Tried to enter text without image again and got:
Array ( [skill_level] => English [question] => What
time is it?
[answer] => now [alt_1] => later [alt_2] => sooner
[alt_3] => better
[additional_notes] => [required] => 1 [weight] => 1
[MAX_FILE_SIZE] =>
1000000 [description] => [submit] => Submit! ) Array
( )



5. Entered text with an image and got:
Array ( [skill_level] => English [question] => What
are you doing?
[answer] => nothing [alt_1] => everything [alt_2] =>
something
[alt_3] => don\'t know [additional_notes] =>
[required] => 1 [weight] =>
1 [MAX_FILE_SIZE] => 1000000 [description] =>
[submit] => Submit! )
Array ( [image] => Array ( [name] => left_bg.gif
[type] => image/gif
[tmp_name] => /var/tmp/phpYKaanz [error] => 0 [size]
=> 2436 ) )


Let me know what you think. I am happy to do more
testing. This is going
to be a very useful program for me.

Best,

Kathie




On Wednesday, July 17, 2002, at 03:20 PM, dj
resonance wrote:

Hi Kathy,

If you wanted, we could troubleshoot the problem
further.  On the add_question.php page, try
putting
the following statements after the

    if (isset($HTTP_POST_VARS['submit'])) {

statement:

print_r($HTTP_POST_VARS) . "<br>";
print_r($HTTP_POST_FILES);
die();

If you then run the page after submitting a
question
and view the source, you'll get a nice formatted
view
of everything the browser passed to the page, and
you
can paste that into an email so I can examine it.
I
suspect that it might be passing an unrecognized
mime
type or something that is causing phptest to barf.
I've read the php docs regarding the
HTTP_POST_FILES
variable and apparently there are a few different
ways
that will specify whether a file was actually
uploaded
or not.  I tested for two of them, but maybe
there's a
third lurking somewhere.  I know at least with IE
I
experience an intermittent problem where the
$submit
variable will not get submitted to any of the add
pages, so I'm unable to do any adding or editing.
The
same thing with mozilla will work fine though.
Probably buggy code in phptest somewhere but
damned if
I can figure out what's causing it.

Thanks,
Brandon




--- Kathleen Ferraro <address@hidden> wrote:
Hi John,

Thanks for following up. After quite a bit of
testing, I've come to
suspect that this is a
browser issue primarily. I had been using
OmniWeb, a
really nice looking
browser
that runs under Mac OS X. I tried adding a
question
using Internet
Explorer 5.1 for the
Mac and had no problem.

Just to clarify, the problem is not with
uploading
an image. The problem
was that
in OmniWeb, I found the following:

        If I did not upload an image, a got the "unknown
file upload
message and
        my question text was not loaded.

        If I did upload an image, everything (image and
text) was loaded twice.

I suppose I should pass this on to the folks at
OMNI. Have not tried it
systematically
with any of the other browsers I experiement
with.

Best,

Kathie

On Wednesday, July 17, 2002, at 08:46 AM, John
Lacey
wrote:

Hi Kathie,

I happened to run across your post and was
wondering if you were still
experiencing a problem.  If so, just send along
some additional info
that
may help, such as the file type (.gif, .jpg,
etc)
and file size.

thanks,
John





There appears to be some conditional statement
missing or misplaced in
add_multiple.php and add_truefalse.php, causing
both "INSERT INTO
questions" queries to fire if an image is
uploaded
and neither to fire
if an image is not uploaded.


  If I enter question text and don't upload an
image, I get the message
"Unknown file upload error"; if I enter text and

=== message truncated ===


__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

--------------------------------------------------------------------------------------------------
Kathleen A. Ferraro | address@hidden Senior Curriculum Specialist | 412.648.1099 (direct) Office of Medical Education (Scaife M211) | 412.648.8714 (main office) University of Pittsburgh | 412.958.0057 (pager) Pittsburgh, PA 15261 USA | 412.383.7477 (fax)
---------------------------------------------------------------------------------------------------
I am pleased that history recognizes the first to invent something, but
I am more concerned with the first person to make it work.
                   --Commodore Grace Murray Hopper, Computing Pioneer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]