Hey... i am including the ability for users to attach images to their posts.. Now... they can attach more than one image.

First time round... the image gets uploaded and everything works fine... second time round though... i get a 'page cannot be displayed' error :queasy: The address in the address bar is correct... i just cant see why its working first time and not second. Anyone experienced this before or myt know why its happening??

Any more info needed.... just ask 🙂

Thanks, BIOSTALL

    You'll need to post the portions of your upload form that pertains to what "name" attributes are for the fields. Also post your code for handling the image uploads? hard to say from your description where the problem is.

      Stuff that... i got that bit working now,

      BUT... what i'm trying to do now is delete part of an array but yet again i'm getting a 'page cannot be displayed' error. The address is the address bar is perfectly fine. Heres the code that constructs the link:

      if ($_GET['imagename']!="") {
      	$iname = $_GET['imagename'];
      	if (!isset($_SESSION['currentfiles'])) {
      		$_SESSION['currentfiles'] = $iname;
      		$attachedfiles = "<li>".$iname."<font size='-1'> - <a href='ForumDiscardImage.php?arraynumber=0&threadid=$threadid&sectionid=$sectid'>Discard Image</a></font></li>";
      	}else{
      		$sesh = $_SESSION['currentfiles'];
      		$exploded1 = explode(",", $sesh);
      		$inarray1 = count($exploded1)-1;
      			if ($exploded1[$inarray1]!=$iname) {
      				$sesh = $sesh.",".$iname;
      			}
      		$_SESSION['currentfiles'] = $sesh;
      		$exploded = explode(",", $sesh);
      		$inarray = count($exploded);
      			if ($inarray==6) {
      				$imglink = "ForumMaximum.php";
      			}else{
      				$imglink = "ForumPostImage.php?threadid=$threadid&sectionid=$sectid";
      			}
      			for ($i=0; $i<count($exploded); $i++) {
      				$attachedfiles .= "<li>".$exploded[$i]."<font size='-1'> - <a href='ForumDiscardImage.php?arraynumber=$i&threadid=$threadid&sectionid=$sectid'>Discard Image</a></font></li>";
      			}
      	}
      	unset($iname, $inarray, $exploded, $exploded1, $inarray1, $sesh, $i);
      	$attachmessage = "<b>Images currently attached:</b><br><br> <i>".$attachedfiles."</i><br>";
      }

      And heres the code thats supposed to delet the element from the array but the page is saying it cannot be displayed:

      $arraynumber = $_GET['arraynumber'];
      $tfid = $_GET['threadid'];
      $sfid = $_GET['sectionid'];
      $sesh = $_SESSION['currentfiles'];
      $exploded = explode(",", $sesh);
      $inarray = count($exploded);
      	if ($inarray==1) {
      		unset($_SESSION['currentfiles']);
      		unset($arraynumber, $sesh, $exploded, $inarray);
      		header("location: ForumNewReply.php?threadid=$tfid&sectionid=$sfid");
      		exit();
      	}else{
      		for ($i=0; $i<$arraynumber; $i++) {
      			$sess1 .= $exploded[$i].",";
      		}
      		for ($i=$arraynumber+1; $i=$inarray-1; $i++) {
      			$sess2 .= $exploded[$i].",";
      		}
      		$finalsess = $sess1.$sess2;
      		$finalsesh = substr_replace($finalsess, "", -1);
      		$_SESSION['currentfiles'] = $finalsesh;
      		$exploded1 = explode(",", $finalsesh);
      		$inarray1 = count($exploded1)-1;
      		$lastitem = $exloded1[$inarray1];
      		unset($arraynumber, $sesh, $exploded, $inarray, $sess1, $sess2, $finalsess, $finalsesh, $exploded1, $inarray1, $i);
      		header("location: ForumNewReply.php?threadid=$tfid&sectionid=$sfid&imagename=$lastitem");
      		exit();
      }
      	

      Would someone mind PLEASE looking through and trying to see where i've gone wrong... i've bin studying it for hours and can't work it out.

      Many Thanks, BIOSTALL

        Write a Reply...