Jump to content

uploading files with various formats


simi131

Recommended Posts

I am trying to upload files of various formats onto a website but whenever I press the create corpus button, I go to a blank page. I think that the database isn't even uploading the file. Any suggestions? Here is some of my code.

 

// Checks to see the format type of the file (text, Biocreative)

if (substr($fileName, -4) == ".txt"){

if(ereg("/\d+/,/\d*/,<text>", $line1)||ereg("/\d+/,/\d*/,/\d*/,/\d*/", $line1)) //the regex should match the first part of the new text format to identify it.

$type = "text";

else

$type = "biocreative";

........

......

....

 

//if the $type = "biocreative"

 

if ($type == "biocreative")

{

$dataArr = explode("\n", $data);

 

foreach($dataArr as $line)

{

$lineArr = explode(" ", $line);

$lineArr1 = explode("\t", $line);

 

$temp = subst($lineArr[0], 4);

 

if($temp == "BC2GM")

corpus_gn($data);

else if(is_int($lineArr1[0]) == true)

corpus_gm($data);

else

corpus_ips($data);

}

 

.....

....

....

 

function corpus_gn($data)

{

global $documents;

 

//Separates the text into line

$dataArr = explode("\n", $data);

 

//Gets each line

foreach($dataArr as $line)

{

$lineArr = explode("\t", $line);

$pmid = trim($lineArr[0]);

 

$text = trim(substr($line, strlen($pmid)+1));

 

$documents[] = array($pmid, $text);

}

}

 

 

 

 

Any help would be appreciated, I'm really stuck.

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/119880-uploading-files-with-various-formats/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.