Jump to content

[SOLVED] Hyperlink PHP Output...


gary_rip

Recommended Posts

Im using the following...

 

<form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post"> 
<b>What kind of zip are you giving me? A...</b><input type="hidden" name="MAX_FILE_SIZE" value="2048000" /> 
<select name="folder"> 
    <option>1/ 
    <option>2/ 
    <option>3/ 
</select><br /> 
<b>The file is...</b> <input name="userfile" type="file" /><br /> 
<input type="submit" value="Upload the zip!" /> 
</form> 

<?php 
if (@is_uploaded_file($_FILES["userfile"]["tmp_name"])) { 
    copy($_FILES["userfile"]["tmp_name"], $_POST["folder"] . $_FILES["userfile"]["name"]); 
    echo "www.testsite.com/files/" . $_POST["folder"] . $_FILES["userfile"]["name"];

} 
?> 

 

But when it out puts...

 

echo "www.testsite.com/files/" . $_POST["folder"] . $_FILES["userfile"]["name"];

 

(Which prints like www.testsite/files/1/test.zip)

 

I wish to make this a hyperlink to the same file.

 

Ive been trying...

 

cho "<a href=http://www.testsite.com/files/" . $_POST["folder"] . $_FILES["userfile"]["name"]>"www.garyrip.com/files/" . $_POST["folder"] . $_FILES["userfile"]["name"]</a>";

 

with no luck...

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/74612-solved-hyperlink-php-output/
Share on other sites

Well, to keep up with the standards, only use double quotes in your HTML tags. I would do like this:

 

<?php
echo '<a href="http://www.testsite.com/files/'.$_POST['folder'].$_FILES['userfile']['name'].'">www.garyrip.com/files/'.$_POST['folder'].$_FILES['userfile']['name'].'</a>';
?>

Archived

This topic is now archived and is closed to further replies.

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