Jump to content

Combing data from multi uploads


KingOfHeart

Recommended Posts

I want to extract data from multiple uploads. I got a script but I'm making some type of mistake because it's not working right. I don't need any of these files saved on the server just need to extract the data. I got it working for one upload, but not multi.

 

function CheckFile()
{
for($i=0; $i < count($_FILES['file']['tmp_name']);$i++)
{
	if ($_FILES["file"]["type"][$i] != "application/octet-stream")
	{	
		continue;
	}
	if($_FILES["file"]["size"][$i] > 1000)
	{
		continue;
	}
	if(substr($_FILES["file"]["name"][$i],-4) != ".lnd")
	{
		continue;
	}
	if ($_FILES["file"]["error"][$i] > 0)
	{
		continue;
	}
	if (is_uploaded_file($_FILES['file']['tmp_name'][$i]))
	{
		$contents = file_get_contents($_FILES['file']['tmp_name'][$i]);
		echo "Contents " . $n . "<br>" . $contents;
		$fileData .= $contents;
	}

}

CreateMap($fileData);
}

 

echo "<form enctype='multipart/form-data' action='zminerupload.php?check=true' method='POST'>
<input type='hidden' name='MAX_FILE_SIZE' value='1000' />
Choose a file to upload:<br> 
<input type='file' name='file[]' id='file[]' /><br>
<input type='file' name='file[]' id='file[]' /><br>
<input type='file' name='file[]' id='file[]' /><br>
<input type='file' name='file[]' id='file[]' /><br>
<input type='submit' name = 'submit' value='Upload File'>
</form>";

 

So where did I goof up?

Link to comment
https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/
Share on other sites

with this if statement

if($_FILES["file"]["size"][$i] > 1000)
	{
		continue;
	}

 

unless all your files are below 1000 bytes (less than a kilobyte!) it will skip every step after that.

 

remember, file is in bytes, so you may want to change that

Well used the original script with a few modifications and noticed I was able to get it successfully uploaded. When I tried to extract the data without it uploading it was too much for it. So I'm fine with just uploading it, but I want to give it set names.

 

map1.txt

map2.txt

map3.txt

map4.txt

 

So how can I rename each upload to those names?

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.