Hi,
The problem has been resolved. The question is too big and the approach that have used in solution is little different. The better solution is to store a file into db is, we store the path of file into db and copy the file into a path.
Code for get value from user and insert into db.
----------------------------
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible"
content="IE=edge,chrome=1">
<meta name="description" content="$1">
<meta name="viewport" content="width=device-width,
initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<title>test</title>
<?php
//add DB connect file here
?>
</head>
<body>
<?php
if(isset($_POST['save'])){
$sql = "INSERT INTO FIELDCALLED (contentName)
VALUES ('".$_POST["contentName"]."')";
}
?>
<form method="post">
<label id="first"> Content
Name:</label><br/>
<input type="text" name="contentName"><br/>
<button type="submit"
name="save">save</button>
</form>
</body>
</html>
------------------------
Code for upload a file and insert into db.
---------------------------------------
fileupload.php
----------------------------
<?php
$path = "home/file";
$path = $path . basename( $_FILES['Filename']['name']);
$Filename=basename( $_FILES['Filename']['name']);
if(move_uploaded_file($_FILES['Filename']['tmp_name'], $path)) {
echo "File ". basename( $_FILES['Filename']['name']). " has been
uploaded";
$link = mysqli_connect("localhost", "root", "", "");
$sql = "INSERT INTO Table-Name (Column-Name)
VALUES ('$filename')" ;
} else {
echo "Error";
}
?>
<form method="post" action="fileupload.php"
enctype="multipart/form-data">
<p>File:</p>
<input type="file" name="Filename">
<input TYPE="submit" name="upload" value="Add"/>
</form>
---------------------------------------
The problem has been resolved, I hope you will like the solution. If you have any question or query regarding this problem or other, please comment below and give the positive rating.
Thank You!! Happy Learning!! !!
Implement a PHP function that reads in input a string from the user and store it in a table (e.g....
You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...
You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...
This code should be written in php. Write a program that allows the user to input a student's last name, along with that student's grades in English, History, Math, Science, and Geography. When the user submits this information, store it in an associative array, like this: Smith=61 67 75 80 72 where the key is the student's last name, and the grades are combined into a single space-delimited string. Return the user back to the data entry screen, to allow...
Helpp: Make an application Protocol Application log for text messages In this task, an application protocol for sending and retrieving text messages is to be developed. A client (eg app on a smartphone) communicates with an application on a web server running a database of user data (username and password) and messages (user name of the sender, user name of the recipient, message text). The client should be able to perform the following actions: Register a new user Log in...
Write a program, called wordcount.c, that reads one word at a time from the standard input. It keeps track of the words read and the number of occurrences of each word. When it encounters the end of input, it prints the most frequently occurring word and its count. The following screenshot shows the program in action: adminuser@adminuser-VirtualBox~/Desktop/HW8 $ wordCount This is a sample. Is is most frequent, although punctuation and capitals are treated as part of the word. this is...
This program will store a roster of most popular videos with kittens. The roster can include at most 10 kittens.You will implement structures to handle kitten information. You will also use functions to manipulate the structure. (1) Create a structure kitten. The structure should contain the following attributes: name; string color; string score; integer Important! The name of the structure and each of its field must match exactly for the program to work and be graded correctly. (2) Create a...
Consider the following C++ program. It reads a sequence of strings from the user and uses "rot13" encryption to generate output strings. Rot13 is an example of the "Caesar cipher" developed 2000 years ago by the Romans. Each letter is rotated 13 places forward to encrypt or decrypt a message. For more information see the rot13 wiki page. #include <iostream> #include <string> using namespace std; char rot13(char ch) { if ((ch >= 'a') && (ch <= 'z')) return char((13 +...
Instructions: Consider the following C++ program. It reads a sequence of strings from the user and uses "rot13" encryption to generate output strings. Rot13 is an example of the "Caesar cipher" developed 2000 years ago by the Romans. Each letter is rotated 13 places forward to encrypt or decrypt a message. For more information see the rot13 wiki page. #include <iostream> #include <string> using namespace std; char rot13(char ch) { if ((ch >= 'a') && (ch <= 'z')) return char((13...
Urgent please! This is in C.
I need to write a function that reads a .txt file in using fgets
(line by line) and makes a linked list, with each node storing a
pointer to a char array that stores one word in the line it reads.
A "word" can be alphabetical, numerical, punctuation, blank lines,
or \n.
I have a struct:
struct node
{
void *data;
struct node *next;
};
that stores a pointer to an array of chars...