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

C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017...
C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017 solution named Ass3, which contains one C# Windows Forms App project also named Ass3 and the project contains a default form, Form1.cs and Program.cs. No change should be made in Program.cs, but your Form1 must be designed and implemented to satisfy the following requirements. **Do not submit only a single file of the solution or project. The whole solution folder of VS 2017 must...
C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017...
C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017 solution named Ass3, which contains one C# Windows Forms App project also named Ass3 and the project contains a default form, Form1.cs and Program.cs. No change should be made in Program.cs, but your Form1 must be designed and implemented to satisfy the following requirements. **Do not submit only a single file of the solution or project. The whole solution folder of VS 2017 must...
C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017...
C# What to submit: One zip file named Ass3.zip This zip must contain one VS 2017 solution named Ass3, which contains one C# Windows Forms App project also named Ass3 and the project contains a default form, Form1.cs and Program.cs. No change should be made in Program.cs, but your Form1 must be designed and implemented to satisfy the following requirements. **Do not submit only a single file of the solution or project. The whole solution folder of VS 2017 must...
Download the following zip file Bag and complete the program. You will need to complete files...
Download the following zip file Bag and complete the program. You will need to complete files MyBag and . MyBag uses the java API class ArrayList as the underline data structure. Using the class variables given, complete the methods of the MyBag class. In your BagHand class you should set appropriate default values for select class variables in the constructor in the add method, use the MyBag object to add a PlayingCard type to the bag and find and set...
Network Reconfiguration Reconfigure the network in the file provided. Then submit a PNG or PDF file...
Network Reconfiguration Reconfigure the network in the file provided. Then submit a PNG or PDF file of your updated network diagram and show screenshot evidence that the project requirements for the following critical elements: A. Properly configure the VLAN for guest and video connections to meet the project requirements. Submit a screenshot of the VLAN table. [CYB-210-01] B. Properly configure the guest wireless network to meet the project requirements. Submit a screenshot of the wireless settings for the wireless router....
. 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...
JAVA Start with the SelectionSort class in the zip file attached to this item. Keep the...
JAVA Start with the SelectionSort class in the zip file attached to this item. Keep the name SelectionSort, and add a main method to it. Modify the selectionSort method to have two counters, one for the number of comparisons, and one for the number of data swaps. Each time two data elements are compared (regardless of whether the items are in the correct order—we're interested in that a comparison is being done at all), increment the comparison counter. Each time...
Complete the code. You are given a zip file that contains an online multiplayer Tic-tac-toe system....
Complete the code. You are given a zip file that contains an online multiplayer Tic-tac-toe system. The system comprises two main modules: Server and Client and uses server – client communication between them. You will have to extend the client and server files to include the missing communications using socket programming. In this game, the server runs indefinitely, waiting for a client. A client connects to the server to see if there are other players online. A client then invites...
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...
BEFORE YOU START MAKE SURE TO SEND AS A TEXT FILE NOT PDF OR PICTURES. WRITE...
BEFORE YOU START MAKE SURE TO SEND AS A TEXT FILE NOT PDF OR PICTURES. WRITE IN A NEXT FILE IN JAVA ECLIPSE FORMAT. WILL BE POSTING THE CODE ON JAVA ECLIPSE. ALSO WILL GIVE THUMBS UP Write a class called Dog that contains instance data that represents the dog’s name and age. Define the Dog constructor to accept and initialize instance data. Include getter and setter methods for the name and age. Include a method to compute and return...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT