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 6972229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:56:29+00:00 2026-05-27T16:56:29+00:00

Basically I want to upload image and Video file with an html form. Image

  • 0

Basically I want to upload image and Video file with an html form. Image is uploading but video file isn’t, When I upload video file it’s show progressing….Can’t see anything.. What is the problem in my code, can anyone help me?

<?php
if(isset($_POST['submit']) == "Submit")
{   
$err = array(); 
@$filed = addslashes($_FILES['file']['tmp_name']);
@$img_named =    addslashes($_FILES['file']['name']);
@$img_sized = getimagesize($_FILES['file']['tmp_name']);
@$imgd = addslashes(file_get_contents($_FILES['file']['tmp_name']));

function getExtension($str)
    {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
    }
$extension = getExtension($img_named);
$extension = strtolower($extension);
$image_named_uniq = uniqid().'.'.$extension;

$upload_path_dis = 'user/manage/discussionimg/';

$diss = $_POST['type'];
$sub = $_POST['sub'];
$msg = $_POST['msg'];
$date = "On " . date("F Y h:i:s A");


if (!isset($_SESSION['uname']))
$err[] = "You need to login";

else
{
$uname = $_SESSION['uname']; //session username

if(empty($sub) && empty($msg) && empty($filed))
$err[] = "All field required";
else
{
if(empty($sub))
$err[] = "Subject Requried";

if(empty($msg))
$err[] = "Message Requried";

if(empty($filed))
$err[] ="SORRY, you have to be upload a image";
else
{ 
if($img_sized == FALSE)
{
$err[] ="That's not an image";  
}
}
}
}


if(!empty($err))
{
foreach($err as $er)
{
echo "<font color=red>$er</font><br/>";
}
}

else
{
$sql= mysql_query("INSERT INTO discussion VALUES ('', '$imgd', '$image_named_uniq', '$diss', '$sub', '$msg', '$uname', '$date' ) ");
if(!$sql)
echo "Can't submit your discussion" . mysql_error();
if(!move_uploaded_file($_FILES['file']['tmp_name'],$upload_path_dis . $image_named_uniq))
{
die('File Not Uploading');
}
else
{
echo "Discussion was submitted";
print "<script>";
print " self.location='          "  .$_SERVER['REQUEST_URI'] . "        ';"; // Comment this line if you don't want to redirect
print "</script>";

}       
}       

}

?>

<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" 
name="discussion" enctype="multipart/form-data">
<table width="240" border="0" cellspacing="0" cellpadding="0">

<tr>
<td><b>Select your image</b>
<input type="hidden" name="MAX_FILE_SIZE" value="62914560"  />
<input type="file" name="file" /></td>
</tr>
<tr>
<td style="width:230;"><b>Select your Discussion</b>
<select name="type" class="td">
<?php   
$sqld = mysql_query("SELECT * FROM distype");

while($row = mysql_fetch_assoc($sqld))
{
$d_id = $row['d_id'];
$diss = $row['type'];
echo "<option value='$diss'>$diss</option>";
}
?>

</select></td>
</tr>
<tr>
<td><b>Subject</b></td>
</tr>
<tr>
<td><input type="text" name="sub" value="" size="33" class="td"/></td>
</tr>
<tr>
<td><b>Message</b></td>
</tr>
<tr>
<td><textarea cols="30" rows="3" name="msg" class="td_text"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit" class="submit"><br>
<td></td>
</tr>
</table>
</form>
  • 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-27T16:56:29+00:00Added an answer on May 27, 2026 at 4:56 pm

    Remove your @ error inhibitors and you’ll see what the problem is:

    $filed = addslashes($_FILES['file']['tmp_name']);
    $img_named =    addslashes($_FILES['file']['name']);
    $img_sized = getimagesize($_FILES['file']['tmp_name']);
    $imgd = addslashes(file_get_contents($_FILES['file']['tmp_name']));
    

    This line of code gets the size of the image:

    $img_sized = getimagesize($_FILES['file']['tmp_name']);
    

    What happens when the image is a video file? You get an error.

    To fix it, check whether the file is an image or a video file using MIME types or extensions (not recommended). If it’s an image, get the size. If it isn’t, don’t get the size.

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

Sidebar

Related Questions

i want to show file upload dialog on click of a button thats not
I have the following html code to upload an image: <input type=file name=before size=40>
I have an app that basically can be used to download, upload, and manage
We have a CSV uploader where users can upload a CSV file filled with
Basically the below is what i want to do in asp.net c#. Steps 1.Upload
Interested in building my own drag'n'drop file uploader using JQuery/AJAX/PHP. Basically I want a
I want to export my contacts from gmail into a csv file.. Then upload
I basically want to use link_to to link to the index method of a
I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log ...with of course
I basically want to do this in code: PersonList myPersonList; //populate myPersonList here, not

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.