AXEL-GFXDesigns Posted June 8, 2007 Share Posted June 8, 2007 Hi, Jus making an Upload Script And trying to have it display the Link to the file for download. Form Code: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="5242880" /> File:<input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> Upload Code(PHP): <?php $target_path = "uploads/"; $_FILES['uploadedfile']['tmp_name']; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $filelink = str_replace(" ","%20",basename( $_FILES['uploadedfile']['name'])); $file = $_FILES['uploadedfile']['name']; if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; ?> <br /> <?php echo "Your Link: <a href=71.76.24.184/uploads/" $filelink ">" $file "</a>";} else{ echo "There was an error uploading the file, please try again!"; } ?> PHP Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\Inetpub\public_html\uploader.php on line 17 Line 17= echo "Your Link: <a href=71.76.24.184/uploads/" $filelink ">" $file "</a>";} Sorry If I'm posting wrong I'm new to the Board and Coding from Scratch in PHP Quote Link to comment https://forums.phpfreaks.com/topic/54690-unexpect-t_variable/ Share on other sites More sharing options...
trq Posted June 8, 2007 Share Posted June 8, 2007 You where missing quite a fewe concatination operators on that line. Ive also formatted it to make it a little easier to read. <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $filelink = str_replace(" ","%20",basename( $_FILES['uploadedfile']['name'])); $file = $_FILES['uploadedfile']['name']; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded<br />"; echo "Your Link: <a href='71.76.24.184/uploads/" . $filelink . "'>" . $file . "</a>"; } else { echo "There was an error uploading the file, please try again!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/54690-unexpect-t_variable/#findComment-270456 Share on other sites More sharing options...
AXEL-GFXDesigns Posted June 8, 2007 Author Share Posted June 8, 2007 Ah, Very Simple! Thanks A lot Can't believe I missed that ...Woah! A page later in PHP I see it! Quote Link to comment https://forums.phpfreaks.com/topic/54690-unexpect-t_variable/#findComment-270466 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.