Jump to content

IT Help please


Recommended Posts

Sangat ji I have received the following from my sister she needs help with php programming so if anyone can help her please let me know & with her permission will give her email in a PM.

here's what ict help she needs:

Note: I am using WAMP server for this.

Using PHP and Weka:

Create a webpage that allows the user to upload a zip file with many directories.

Read the files from the directories and create an array of the words from all the files and assign every word to a unique number with no duplicates, eg.

"I went to see the movie, the movie was great"

I -> 1

went -> 2

to -> 3

see -> 4

the -> 5

movie -> 6

the -> 5

movie -> 6

was -> 7

great -> 8

obviously 'the' and 'movie' would only appear once.

Once that is done state the number of times every array/number appeared:

{1 1, 2 1, 3 1, 4 1, 5 2...etc} so 5=the and it appeared twice. This must continue to the next file read so if the second file says 'movie' {6 3} because movie will have appeared 3 times.

Convert into an .arff file that is accepted by Weka, and run Weka through the command line (using PHP) to apply the algorithms against the file.

Output the result to the user on the webpage.

Sangat ji hope you can help as she's really struggling & this is for final year of studies. Many thanks Gurmukho

Link to comment
Share on other sites

I use to do programing in PHP.... Ok give me time till Sunday...I need to download wamp n again would have to do programing....n lets me know here email addreed

I think I must b having one template for uploading files...give me a day...

Link to comment
Share on other sites

Try these codes for uploading.......

if ((($_FILES["file"]["type"] == "application/zip")
|| ($_FILES["file"]["type"] == "application/x-zip-compressed")
|| ($_FILES["file"]["type"] == "multipart/x-zip")
|| ($_FILES["file"]["type"] == "application/x-compressed")
|| ($_FILES["file"]["type"] == "application/octet-stream"))
&& ($_FILES["file"]["size"] < 20971520))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}

or

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_FILES['file'])) {
if ($_FILES['file']['error'] === UPLOAD_ERR_OK) {
... file was succesfully uploaded, process it
} else {
... file upload failed, output error message, etc...
} else {
... no upload at all, not even an attempt
}
} else {
.... not in a POSt environment, so can't possibly have a file upload ...
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • advertisement_alt
  • advertisement_alt
  • advertisement_alt


×
×
  • Create New...

Important Information

Terms of Use