KingOfHeart Posted October 10, 2009 Share Posted October 10, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/ Share on other sites More sharing options...
KingOfHeart Posted October 10, 2009 Author Share Posted October 10, 2009 So no one worked with multiple uploads before? Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/#findComment-934572 Share on other sites More sharing options...
mikesta707 Posted October 10, 2009 Share Posted October 10, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/#findComment-934581 Share on other sites More sharing options...
KingOfHeart Posted October 10, 2009 Author Share Posted October 10, 2009 The max it will get is less then 50 bytes. I was getting an error as well, but since I know I'm going in the right direction I'll try to find the error myself. Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/#findComment-934590 Share on other sites More sharing options...
KingOfHeart Posted October 10, 2009 Author Share Posted October 10, 2009 Well anytime I try to do a multiupload, even with just two files I get this message. "I'm sorry! There was an internal Server Error!" Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/#findComment-934602 Share on other sites More sharing options...
mikesta707 Posted October 10, 2009 Share Posted October 10, 2009 well that probably has to do either with the server settings, or the upload script itself. None of the code i have seen in this post would cause that Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/#findComment-934608 Share on other sites More sharing options...
KingOfHeart Posted October 11, 2009 Author Share Posted October 11, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/177145-combing-data-from-multi-uploads/#findComment-934943 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.