elementz Posted April 3, 2006 Share Posted April 3, 2006 Here are the files:[b]index.html[/b][code]<html><head><title>Worlds Hosting Image Uploader</title></head><body><table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td><strong>Image Upload</strong></td></tr><tr><td>Select Image <input name="ufile" type="file" id="ufile" size="50" /></td></tr><tr><td align="center"><input type="submit" name="Submit" value="Upload" /></td></tr></table></td></form></tr></table></body></html>[/code][b]upload.php[/b][code]<html><head><title>Worlds Hosting Image Uploader</title></head><body><?php$valid = array (".png",".jpg",".gif",".bmp");$filename = $HTTP_POST_FILES['ufile']['name'];$type = strtolower(strstr($filename, '.'));if (!in_array($type, $valid)) {echo ("The submitted file was of invalid type.<br />");} $random_digit=rand(00000000,99999999);$new_file_name=$random_digit.$filename;$path= "upload/".$new_file_name;if($ufile !=none){if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)){echo "Successful<BR/>"; $homeurl='http://www.worlds-hosting.com/image/upload/'$url=$homeurl.$new_file_name;}else{echo "Error";}}?><img src="<? echo $url; ?>"><br><br><a href="<? echo $url; ?>"><? echo $url; ?></a><br><?phpecho "File Size: ".$HTTP_POST_FILES['ufile']['size']."<BR />"; echo "File Type: ".$HTTP_POST_FILES['ufile']['type']."<BR/>"; ?></body></html>[/code]But when I try to run it, it gets the following error:[b]Parse error: parse error, unexpected T_VARIABLE in /home/worldsh/public_html/image/upload.php on line 36[/b]Please help fix it.Thankyou,Luke Quote Link to comment Share on other sites More sharing options...
shocker-z Posted April 3, 2006 Share Posted April 3, 2006 [code]$homeurl='http://www.worlds-hosting.com/image/upload/'$url=$homeurl.$new_file_name;[/code]needs to be[code]$homeurl='http://www.worlds-hosting.com/image/upload/';$url=$homeurl.$new_file_name;[/code]You missed ; at the end :)RegardsLiam Quote Link to comment 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.