Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3236052
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:34:38+00:00 2026-05-17T17:34:38+00:00

I wrote a Facebook app from PHP and HTML that work perfect in the

  • 0

I wrote a Facebook app from PHP and HTML that work perfect in the Opera browser, but doesn’t work in Internet Explorer or Google Chrome.

The page index of the app is at: http://apps.facebook.com/zbtmajik/

After you choose an image to upload and choose the ‘Upload’ button, it is supposed to redirect to http://majik.zbrowntechnology.info (inside the iframe ) and keeps redirecting to
http://majik.zbrowntechnology.info/?auth_token=e0afbd3167ae943a94b41e940298f2d1&next=http%3A%2F%2Fmajik.zbrowntechnology.info%2Fupload.php

I think it might be an issue with the iframe since it seems like when I submit the form, it attempts to redirect the entire page instead of just what is in the iframe.

I have know idea what the problem is, but it is for work and I need to get it fixed. Any help would result in your name on a thank you page on the app!

_____ upload.php____________________________________________________________________
I was told that it may be the PHP code that processes the upload, so here it is:

<?php
include_once('facebook.php');
$appapikey = 'API KEY HERE';
$appsecret = 'SECRET KEY HERE';
$facebook = new Facebook($appapikey, $appsecret);
$fb_user =  $facebook->require_login();

if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
  $filename = basename($_FILES['uploaded_file']['name']);
  $ext = substr($filename, strrpos($filename, '.') + 1);
  if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && 
    ($_FILES["uploaded_file"]["size"] < 350000)) {
      $newname = dirname(__FILE__).'/upload/zbt_'.$fb_user.'.jpg';
      if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
         header("Location: http://majik.zbrowntechnology.info/display.php");
      } else {
         header("Location: home.php?Fatal");
      }
  } else {
     header("Location: home.php?Fatal");
  }
} else {
 header("Location: home.php?Fatal");
}
?>

I have looked over it and can’t seem to find anything, but I’m not a very strong PHP programmer either.

I looked over the code again in the PHP doc, and found that the problem lies on this line: if((!empty($_FILES[“uploaded_file”])) && ($_FILES[‘uploaded_file’][‘error’] == 0)) {. Not sure exactly what it is though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:34:39+00:00Added an answer on May 17, 2026 at 5:34 pm

    I have looked at your PHP script in the question. As we have eliminated the redirect as the cause of the problem, let’s look at the upload handler.

    I have rewritten the script, and included a pile of debug messages, and I have also added a line which will delete an existing file if a user uploads a second one.

    <?php
    
    include_once( 'facebook.php' );
    $appapikey = 'API KEY HERE';
    $appsecret = 'SECRET KEY HERE';
    $facebook  = new Facebook( $appapikey , $appsecret );
    $fb_user   = $facebook->require_login();
    
    if( empty( $_FILES['uploaded_file'] )
        || $_FILES['uploaded_file']['error']!=0
        || !preg_match( '/\.jpe?g$/i' , basename( $_FILES['uploaded_file']['name'] ) )
        || $_FILES['uploaded_file']['type']!='image/jpeg'
        || $_FILES['uploaded_file']['size']>350000 ){
     /* DEBUG CODE - START */
      echo '<h2>Error Detected</h2>';
      echo '<ul>';
        echo ( empty( $_FILES['uploaded_file'] )
             ? '<li>No Files - Empty</li>' : '' );
        echo ( $_FILES['uploaded_file']['error']!=0
             ? '<li>Error '.implode(',',$_FILES['uploaded_file']['error']).'</li>' : '' );
        echo ( !preg_match( '/\.jpe?g$/i' , basename( $_FILES['uploaded_file']['name'] ) )
             ? '<li>Filename does not look like a JPEG</li>' : '' );
        echo ( $_FILES['uploaded_file']['type']!='image/jpeg'
             ? '<li>Filetype is '.$_FILES['uploaded_file']['type'].'</li>' : '' );
        echo ( $_FILES['uploaded_file']['size']>350000
             ? '<li>Filesize is '.$_FILES['uploaded_file']['size'].'</li>' : '' );
      echo '</ul>';
     /* DEBUG CODE - END */
      if( !headers_sent() )
        header( 'Location: home.php?fatal' );
      die();
    }
    
    $newname = dirname(__FILE__).'/upload/zbt_'.$fb_user.'.jpg';
    
    if( file_exists( $newname ) ){
     # User file already exists - Delete the Existing one.
      unlink( $newname );
    }
    
    if( !move_uploaded_file( $_FILES['uploaded_file']['tmp_name'] , $newname ) ){
     /* DEBUG CODE - START */
      echo '<h2>Error Detected</h2>';
      echo '<ul>';
        echo '<li>Unable to Move File</li>';
      echo '</ul>';
     /* DEBUG CODE - END */
      if( !headers_sent() )
        header( 'Location: home.php?fatal' );
      die();
    }
    
    header( 'Location: display.php' );
    die();
    

    If/when it works, remove anything between the /* DEBUG CODE - XXX */ sets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a windows service using VB that read some legacy data from Visual
I wrote myself a little downloading application so that I could easily grab a
I wrote a component that displays a filename, a thumbnail and has a button
I wrote a simple tool to generate a DBUnit XML dataset using queries that
I wrote an application that currently runs against a local instance of MySql. I
I wrote a utility for photographers that I plan to sell online pretty cheap
I'm developing a facebook app right now all by my lonesome. I'm attempting to
A Facebook Sync app filled the address fields of my Mac Address Book contacts
I am trying to write a facebook app using app-engine-patch and pyFacebook. I am
I wanted to add user search auto-complete (like Facebook's) to my Rails app on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.