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

  • SEARCH
  • Home
  • 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 7803181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:29:28+00:00 2026-06-02T01:29:28+00:00

I am creating an application of uploading swf files in a folder using PHP.

  • 0

I am creating an application of uploading swf files in a folder using PHP.
My script is all working except for the first if condition where I’m checking whether the extension is swf or not, but I seems to have some error.

I’m not sure whether video/swf is a valid checking parameter for SWF files or not. My full script is below. I’m checking the size of the SWF using getimagesize(). Some people may wonder that getimagesize works for image, but I saw some examples where getimagesize() has been used for getting size of SWF files.

It’s giving me the message “invalid swf file”, that means its not satisfying the first checking condition at all.

<?php
        foreach($_FILES['item_swf']['tmp_name'] as $key=>$val)
        {

        list($width, $height) = getimagesize($_FILES['item_swf']['tmp_name'][$key]);

        if (( ($_FILES["item_swf"]["type"][$key] == "video/swf") || ($_FILES["item_swf"]["type"][$key] == "video/SWF") )
        && ($_FILES["item_swf"]["size"][$key] < 800000))
           {
                if ($_FILES["item_swf"]["error"][$key] > 0)
                  {
                     echo "Error: " . $_FILES["item_swf"]["error"][$key] . "<br />";
                  }
                else if($width==1000 && $height==328)
                  {
                   if (file_exists('../../swf_folder/header_swf/' . $_FILES["item_swf"]["name"]))
                            {
                               echo $_FILES["item_swf"]["name"][$key] . " already exists. ";
                             }
                   else
                            { 

                               move_uploaded_file($val, '../../swf_folder/header_swf/'.$_FILES['item_swf']['name'][$key]);
                               echo "done";
                        }
                  }
             else 
                 {
                    echo "size doest permit";
                 }  
            }
        else
            {
               echo "Not a valid swf file::";
            }                       

        }
        ?>

The line given below

move_uploaded_file($val, '../../swf_folder/header_swf/'.$_FILES['item_swf']['name'][$key]);

is working perfectly as it is uploading files to the dedicated folder, it somehow seems that the checking parameters for SWF only files are not set properly.

Edit

I got my answer. Instead of using video/swf I need to use application/x-shockwave-flash.

So the ultimate code will be:

<?php
        foreach($_FILES['item_swf']['tmp_name'] as $key=>$val)
        {

        list($width, $height) = getimagesize($_FILES['item_swf']['tmp_name'][$key]);

        if (($_FILES["item_swf"]["type"][$key] == "application/x-shockwave-flash") 
        && ($_FILES["item_swf"]["size"][$key] < 800000))
           {
                if ($_FILES["item_swf"]["error"][$key] > 0)
                  {
                     echo "Error: " . $_FILES["item_swf"]["error"][$key] . "<br />";
                  }
                else if($width==1000 && $height==328)
                  {
                   if (file_exists('../../swf_folder/header_swf/' . $_FILES["item_swf"]["name"]))
                            {
                               echo $_FILES["item_swf"]["name"][$key] . " already exists. ";
                             }
                   else
                            { 

                               move_uploaded_file($val, '../../swf_folder/header_swf/'.$_FILES['item_swf']['name'][$key]);
                               echo "done";
                        }
                  }
             else 
                 {
                    echo "size doest permit";
                 }  
            }
        else
            {
               echo "Not a valid swf file::";
            }                       

        }
        ?>
  • 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-06-02T01:29:29+00:00Added an answer on June 2, 2026 at 1:29 am

    ok, i got my answer….

    instead of using video/swf i need to use application/x-shockwave-flash

    so the ultimate code will be

    <?php
            foreach($_FILES['item_swf']['tmp_name'] as $key=>$val)
            {
    
            list($width, $height) = getimagesize($_FILES['item_swf']['tmp_name'][$key]);
    
            if (( ($_FILES["item_swf"]["type"][$key] == "application/x-shockwave-flash") || ($_FILES["item_swf"]["type"][$key] == "video/SWF") )
            && ($_FILES["item_swf"]["size"][$key] < 800000))
               {
                    if ($_FILES["item_swf"]["error"][$key] > 0)
                      {
                         echo "Error: " . $_FILES["item_swf"]["error"][$key] . "<br />";
                      }
                    else if($width==1000 && $height==328)
                      {
                       if (file_exists('../../swf_folder/header_swf/' . $_FILES["item_swf"]["name"]))
                                {
                                   echo $_FILES["item_swf"]["name"][$key] . " already exists. ";
                                 }
                       else
                                { 
    
                                   move_uploaded_file($val, '../../swf_folder/header_swf/'.$_FILES['item_swf']['name'][$key]);
                                   echo "done";
                            }
                      }
                 else 
                     {
                        echo "size doest permit";
                     }  
                }
            else
                {
                   echo "Not a valid swf file::";
                }                       
    
            }
            ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application running with a working table called ANIMAL. Upon first creating
Actually I'm creating an application for uploading file using JSF. But whenever I upload
Im creating application in java using XML. XML- <?xml version=1.0 encoding=UTF-8?> <songlist id=slist> <song
I am creating application for MAC using cocoa framework, I would like to know
I am creating application in facebook using iframe. In that i want to redirect
I have a small doubt, so apologies first. I am creating an iPhone application
I'm creating a web application that will involve habitual file uploading and retrieval (PDFs,
We are creating an installer using WIX 3.6 for a Silverlight/WCF application. We require
I am new in creating application using Visual Studio 2010 and Microsoft Access 2007.
I am creating application in AIR using JavaScript. Many of my functions requires text

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.