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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:56:33+00:00 2026-05-31T11:56:33+00:00

I have searched all over the internet on the possibility to upload a pdf

  • 0

I have searched all over the internet on the possibility to upload a pdf file using php script. I tried all the suggestions given in this site and it didn’t work.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Uploaded</title>
</head>

<body>
<?php
//ini_set("upload_max_filesize", 10000000);
$uploaddir = './uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
//$allowed_ext = "pdf";
//$max_size = "9000000000000000000000";
define('MAX_FILE_SIZE', 0);
echo "<p>";
if((($_FILES["userfile"]["type"] == "image/gif")
  || ($_FILES["userfile"]["type"] == "image/jpeg")
  || ($_FILES["userfile"]["type"] == "image/png" )
  || ($_FILES["userfile"]["type"] == "image/jpg")
  || ($_FILES["userfile"]["type"] == "application/msword")
  || ($_FILES["userfile"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
  || ($_FILES["userfile"]["type"] == "text/plain")
  || ($_FILES["userfile"]["type"] == "application/wordperfect6.0")
  || ($_FILES["userfile"]["type"] == "application/pdf"))
  && ($_FILES["userfile"]["size"] < 10000000))
  {

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  echo "File is valid, and was successfully uploaded.\n";
}     else {
   echo "Upload failed";
}
  }
echo "</p>";
echo '<pre>';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";  
?> 
</body>
</html>
  • 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-31T11:56:34+00:00Added an answer on May 31, 2026 at 11:56 am

    try to print the type recongnized of your file in the else statement instead of simply printing “Upload failed”.

    echo ($_FILES["userfile"]["type"]);
    

    Maybe the tyope recognized is not one belonging to the types specified in the if.

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

Sidebar

Related Questions

I have searched all over the internet trying to find example code in PHP
I have searched all over the Internet for a guide to connect Hadoop and
I have searched all over the internet for programming in Binary and the only
I have searched all over the internet and SO, and I have found some
I have searched all over for this. In Delphi/Lazarus, given a position, I want
I am working on an un-ordered list. I have searched all over the internet
I have searched all over the web with no luck of making this project
So I have searched all over the place and I can not seem to
I have read the documentation and searched all over but I can't find how
I searched how to implement + operator properly all over the internet and all

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.