Jump to content

Archived

This topic is now archived and is closed to further replies.

hadoob024

Different behavior between desktop and BlackBerry

Recommended Posts

I can't seem to figure this one out. On my site, I have a real estate listing form. One of the fields is for the user to be able to upload a picture. Now, when I access this page on my PC at home, I have no problems. The error handling and security checks work fine. Regardless of whether I input info for this picture field, the form processor works.

However, whenever I try and submit this form using a BlackBerry, I keep getting the following error message:
"Error Message: Undefined index: picture"


And apparently this line of code is the culprit:
PHP Code:
[code]if (($_FILES['picture']['size'] != 0) && ($_FILES['picture']['tmp_name'] != ''))[/code]



I just can't figure out why this works perfectly on my PC, but causes an error on my BlackBerry. Any thoughts?

Share this post


Link to post
Share on other sites
if (($_FILES['picture']['size'] != 0) && ($_FILES['picture']['tmp_name'] != ''))

try somthink like that ok.

if ((!$_FILES['picture']['size'] == 0) && (!$_FILES['picture']['tmp_name'] == 0 ''))

Share this post


Link to post
Share on other sites
Try doing a [b]print_r[/b] on the [b]$_FILES[/b] array to see what's in it. Maybe it's sending the form variables differently.

Share this post


Link to post
Share on other sites
Good call! I think the BlackBerry just doesn't send $_POST stuff properly.  Like if a field isn't filled out, I think it might just not be adding it to the $_POST array (instead of just assigning a NULL value).  I added

(isset($_FILES['picture']))

to my "if" statement, and this solved the problem! Sweet! It works on the BlackBerry now. Thanks everyone!!!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.