Jump to content

web page displaying code?


hellonoko

Recommended Posts

my php page is suddenly displaying half code half what it should display.

 

I made a few minor changes to the code but nothing really.

 

Running this off of WAMP. Not getting any errors.

 

What causes this?

 

"; echo ""; echo "Name: ".$_FILES['imagefile']['name'].""; echo "

"; echo "Size: ".$_FILES['imagefile']['size'].""; echo "

"; echo "Type: ".$_FILES['imagefile']['type'].""; echo "

 

"; echo "Copy Done...."; } else { echo "

 

"; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")

"; } } // echo "

 

"; // $image_to_thumbnail = $_FILES['imagefile']['name']; // echo $image_to_thumbnail; //include "resize_image.php"; ?>

 

 

 

Acctual code:

 

<?php

include "admin_menu.php";

?>


<title>Upload Image</title><form name="form1" method="post" action="" enctype="multipart/form-data">
<input name="imagefile" type="file" size="100">

<input type="submit" name="Submit" value="Upload"> 


<?

if(isset( $Submit ))
{
	//If the Submitbutton was pressed do:

	if ($_FILES['imagefile']['type'] == "image/jpeg")
	{
		copy ($_FILES['imagefile']['tmp_name'], "../images/full/".$_FILES['imagefile']['name']) or die ("Could not copy"); 

		echo "<br><br>";
		echo ""; 
        	echo "<b>Name: </b>".$_FILES['imagefile']['name'].""; 
		echo "<br>";
        	echo "<b>Size: </b>".$_FILES['imagefile']['size'].""; 
        	echo "<br>";
		echo "<b>Type: </b>".$_FILES['imagefile']['type'].""; 
        	echo "<br><br>";
		echo "<b>Copy Done....</b>"; 
        }

 else 
 {
            echo "<br><br>";
            echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";
     }
}   

//	echo "<br><br>";
//	$image_to_thumbnail = $_FILES['imagefile']['name'];
//	echo $image_to_thumbnail;

//include "resize_image.php";
?> 

</form>

Link to comment
Share on other sites

Is the problem still that the code is displaying, or that the code is not working?

Use the <?php tag.

 

Edit:

That is not how to properly access a variable. If the form's method is post, you need to do $submit = $_POST['submit']; before using it.

Link to comment
Share on other sites

check all of your { } you need to make sure you open and close these or you will get that error, i see that you did not close your first IF function but you closed the second one

 

I take that back you did, but try moving them around thats the only reason you would get that error...because if the IF statement is false you definitely wouldn't get that error

Link to comment
Share on other sites

I am not sure what your pointing out here Archadian?

 

echo "<br><br>";
		echo ""; 
        	echo "<b>Name: </b>".$_FILES['imagefile']['name'].""; 
		echo "<br>";
        	echo "<b>Size: </b>".$_FILES['imagefile']['size'].""; 
        	echo "<br>";
		echo "<b>Type: </b>".$_FILES['imagefile']['type'].""; 
        	echo "<br><br>";
		echo "<b>Copy Done....</b>"; 

 

The problem is that my code was working. And then for no reason it stopped working. When i added the code at the bottom of the page that is commented out.

 

Jessi:

 

I may just go for a restart and reinstall of WAMP

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.