Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. ok i have the code update and its reading the file contents updated code: $action = $_GET['action']; $session_id = $_GET['osCAdminID']; $targetPath = 'Upload/'; $randomNumber = rand(1000, 9999); switch($action) { case "upload": foreach($_FILES['file']['tmp_name'] as $key => $value) { if(move_uploaded_file($_FILES['file']['tmp_name'][$key], $targetPath . $randomNumber . '-' . $_FILES['file']['name'][$key])) { $aryFiles[] = $randomNumber . '-' . $_FILES['file']['name'][$key]; } else { $continue = 99; } if($continue == 99) { echo '<strong>There was a problem uploading your files</strong>'; } else { foreach($aryFiles as $key => $file) { $lnct = 0; $fileRead = fopen($targetPath . $file, 'r'); while(!feof($fileRead)) { $fileContent[$key][$lnct] = explode(',',fgets($fileRead)); foreach($fileContent[$key][$lnct] as $subkey => $column) { $quoFix = $column; if(substr($quoFix, 0, 1) == '"') $quoFix = substr($quoFix, 1, (strlen($quoFix)-1)); if(substr($quoFix, (strlen($quoFix)-1), 1) == '"') $quoFix = substr($quoFix, 0, (strlen($quoFix)-1)); if($quoFix) $fileContent[$key][$lnct][$subkey] = $quoFix; } $lnct++; } fclose($fileRead); } } } print_r ($fileContent); Now i want to compare the contents from array 1 and contents from array 2. The file contents are read line for line and placed into an array. $fileContent[0] is one array and $fileContent[1] is another array. I can't use array_diff() cause the column counts are different in each file... any ideas here?
  2. yeah the code just creates an inifinite loop and causes my browser to crash... updated code: foreach($_FILES['file']['name'] as $n => $name) { if(!empty($name)) { $target_path = "Upload/" . $name; if(move_uploaded_file($_FILES['file']['tmp_name'][$n], $target_path)) { $i=0; $handle = @fopen($target_path, "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $pieces = explode(",", $buffer); $x=0; while($pieces[$x]) { $your_array[$i].=$pieces[$x]; $x++; } print_r($your_array); $i++; } } } } }
  3. ok so it created an infinite loop... updated code: foreach($_FILES['file']['name'] as $n => $name) { if(!empty($name)) { $target_path = "upload_path/" . $name; if(move_uploaded_file($_FILES['file']['tmp_name'][$n], $target_path)) { $i=0; $handle = @fopen($target_path, "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $pieces = explode(",", $buffer); $x=0; while($pieces[$x]) { $your_array[$i].=$pieces[$x]; } print_r($your_array); $i++; } } } } }
  4. here is what line of code from one of the files looks like 000-100-034,"FEED FRAME INSERT ",83,000-100-034.jpg,328 NEW STYLE,754,"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
  5. i get this error message Notice: Undefined offset: 2 Then the word Array is printed all the way down the screen
  6. this is the code i just updated and i am getting a blank screen: foreach($_FILES['file']['name'] as $n => $name) { if(!empty($name)) { $target_path = "upload_path/" . $name; if(move_uploaded_file($_FILES['file']['tmp_name'][$n], $target_path)) { $i=0; $handle = @fopen($name, "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle); $pieces = explode(",", $buffer); $one = $pieces[0]; $two = $pieces[1]; $three = $pieces[2]; $your_array[$i]=$one.",".$two.",".$three; echo $your_array . "<br />"; $i++; } } } } }
  7. thanks for the code... i will be testing it now... this is a good start at least. I am going to be needing to compare two csv files and where ever there is a match up between the two files it is to insert the contents in to a set of db tables. And the ones that could not match up there is supposed to be a error report generated showing the entries that could not be matched up
  8. how do i parse the data in a csv file to read every chunk of data? i want to place the contents of the csv file into an array with the delimiter being a comma
  9. thanks sasa! Its been a really long week... getting laid off from your job is a week killer!
  10. I have the following error from my code: Warning: Invalid argument supplied for foreach() in csv_upload.php on line 10 Here is my code: foreach($_FILES['file']['name'] as $n => $name) { if(!empty($name)) { $target_path = "path_to_upload_folder/" . $name; if(move_uploaded_file($_FILES['file']['tmp_name'][$n], $target_path)) { echo 'files loaded'; } } } form code: echo '<form action="csv_upload.php?action=upload&osCAdminID=' . $session_id . '" method="post">'; echo '<label for="file1">File 1</label> <input type="file" name="file[]" />'; echo '<br /><br />'; echo '<label for="file2">File 2</label> <input type="file" name="file[]" />'; echo '<br /><br />'; echo '<input type="submit" value="Submit Information" />'; echo '</form>';
  11. I have this array: $myArr=array("<b>Id</b>","<b>Project</b>","<b>Project Id</b>","<b>PM</b>","<b>Designer</b>","<b>PM</b>","<b>Writer</b>","<b>PM</b>","<b>Designer</b>","<b>PM</b>","<b>Christine</b>","<b>PM</b>","<b>Designer</b>", "<b>PM</b>","<b>Julie</b>","<b>PM</b>","<b>Designer</b>","<b>PM</b>","<b>Proofreading</b>","<b>PM</b>","<b>Layne</b>","<b>PM</b>","<b>Programming</b>","<b>PM</b>","<b>Testing</b>"); How do i go about going through each item in the array and making it bold without having to place the <b></b> tags in the array?
  12. try this http://us3.php.net/manual/en/function.mysql-get-server-info.php
  13. this cannot be done... as the color of the subject line is handled by the users choice of email client.
  14. you could create an info.php script like this <?php phpinfo(); ?> And then just run it in your browser
  15. Change if((isset$_POST['apply']) to if(isset($_POST['apply']))
  16. try echoing out $_POST['apply'] and see what you get
  17. try this if (empty($fname)){ $error .='No first name<br>'; }
  18. can you give me an example? I am wanting to say something to the affect of copy this row into this DB WHERE id = (insert id # here)
  19. change $_POST[apply] to $_POST['apply']
  20. Is there a way to copy an entire row into another DB specific to its row id?
  21. thanks everyone! I am working on the archiving script now... i was just a little unsure on moving the files! Thanks for all of your help!
  22. can someone give me an example on how this is done? I have a site that houses projects for my company and they are wanting to add an archive functionality and I am wanting to be able to move the individual uploads for the projects into an archive directory
  23. I used to work in a MAC environment and used Dreamweaver and had no problems with it
  24. I have a website that allows users to upload files. I am wanting to display those files and next to the individual files display a delete link/button and when the user clicks that link/button it will delete the file without having to reload the page. Can anyone point me in the right direction for a good tutorial on how to do this?
  25. As I was typing that Discomatt beat me too it! So i Second his motion!
×
×
  • 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.