Question

In: Computer Science

You are required to develop a utility for uploading a file in .rar, .zip and .pdf...

You are required to develop a utility for uploading a file in .rar, .zip and .pdf format using the reusable code of PHP from any online resources. To do this assignment you need to use the FILE element of html forms and on submission the next page should include the php code for completing the operation of file upload. You can use file directories, databases for maintaining your files at your web server along with your web application.

Solutions

Expert Solution

// Front side code
<html>
<head>
    <title>File Form</title>
</head>
<body>
    <form action="done.php" method="post" enctype="multipart/form-data">
        <h3>Upload Any Format</h3>
        <label for="fileSelect">Filename:</label>
        <input type="file" name="file" id="fileSelect">
        <input type="submit" name="submit" value="Upload">
        
    </form>
</body>
</html>
// done.php
<?php
   if(isset($_FILES['file'])){
      $errors= array();
      $file_name = $_FILES['file']['name'];
      $file_tmp =$_FILES['file']['tmp_name'];
      $file_type=$_FILES['file']['type'];
      $file_ext=strtolower(end(explode('.',$_FILES['file']['name'])));
      
      $extensions= array("rar","zip","pdf");
      if(in_array($file_ext,$extensions)=== false)
      {
         $errors[]="extension not allowed, please choose a rar, zip or pdf file.";
      }
      
      if(empty($errors)==true)
      {
         move_uploaded_file($file_tmp,"files/".$file_name);
         echo "Success";
      }
       else
      {
         print_r($errors);
      }
   }
?>

Related Solutions

. You must use Excel (submit either a pdf, word or Excel file only). . You...
. You must use Excel (submit either a pdf, word or Excel file only). . You must identify the 5 steps (you must address each in detail). Problem: Use the given data to complete a t-test using Excel. Question: Is there a difference in group means between the number of words spelled correctly for two groups of fourth graders? Group Assignment Score 1 3 1 4 1 10 2 14 2 7 2 8 2 10 2 15 2 9...
Instructions: You must complete the questions below. All will be included in a SINGLE PDF file...
Instructions: You must complete the questions below. All will be included in a SINGLE PDF file and turned into Blackboard or handed at the start of class. The due date is specified on the syllabus. Remember, late work is not accepted. You will need an Executive Summary, PowerPoint (one to page/color) and Excel spreadsheet. Be prepared to present your findings in class. Purpose: You must evaluate the various options to ship freight from Asia to the USA. You MUST find...
a)   What is Utility ? Develop a two dimensional model of Total Utility,, and explain the...
a)   What is Utility ? Develop a two dimensional model of Total Utility,, and explain the purpose of this model. b) What is Marginal Utility? Derive it from Total Utility. c) Using utility analysis: if one is economically rational, how does he/she allocate his/her choices ? d) What are indifference curves ? Develop and demonstrate via a two dimensional model. e) Given indifference curves, how is a decision made as to choices ?        Demonstrate.
Imagine you are a Senior Officer at the Ministry of Agriculture; you are required to develop...
Imagine you are a Senior Officer at the Ministry of Agriculture; you are required to develop a plan that leads to the efficient utilization of fruits in Guyana by the various stakeholders. Discuss your proposed plan from beginning to end that will contribute to stopping the wastage of fruits in Guyana.
For Assignment 2, submit a word or pdf file with the SQL queries along with screenshots...
For Assignment 2, submit a word or pdf file with the SQL queries along with screenshots of the outputs. (It is ok if the whole problem cannot be answered, if possible, I just would like an idea of how to begin, thanks in advance!) 9. Write a query to count the number of invoices. 10. Write a query to count the number of customers with a balance of more than $500. 11. Generate a listing of all purchases made by...
You are required to read in a list of stocks from a text file “stocks.txt” and...
You are required to read in a list of stocks from a text file “stocks.txt” and write the sum and average of the stocks’ prices, the name of the stock that has the highest price, and the name of the stock that has the lowest price to an output file. The minimal number of stocks is 30 and maximal number of stocks in the input file is 50. You can download a input file “stocks.txt” from Canvas. When the program...
Using the zip file provided, create a secure login/registration app. Make sure that your game pages...
Using the zip file provided, create a secure login/registration app. Make sure that your game pages (at least two) are unavailable to unregistered users. Upload a zip file with your working PHP application. Contents of zip Index.php ----------------- <!DOCTYPE html> <html>     <head>         <meta charset="UTF-8">         <title></title>     </head>     <body>         <?php         // 1. display error message in the session (if any): $_SESSION['error']         // 2. display either the user's name and the game menu or the...
You are required to develop a computer code that that can solve systems of ODE. The...
You are required to develop a computer code that that can solve systems of ODE. The code should request the user to choose one of the following methods for solving the system: ? Euler ? 4th Order Runge Kutta  
The assignment in this topic required you to develop a performance management plan for a hypothetical...
The assignment in this topic required you to develop a performance management plan for a hypothetical new allied care organization in your field. What regulatory standards will apply to your organization? What accreditation standards? How will these regulations affect the development of your plan, and what measures will you take to ensure your organization is in compliance?
You are required to develop arguments by integrating course concepts of marketing. The topic is -...
You are required to develop arguments by integrating course concepts of marketing. The topic is - "Gender/racial inequality in Canada." Answer the following questions based on the topic "Gender/racial inequality in Canada". Each answer should be answered very briefly with 350-400 words. Part 1 1. What is this issue and why is it important? 2. Why and how is business an important player in this issue? 3. Who are the key stakeholders? Explain
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT