Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2006
    Location
    Las Vegas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    image upload form

    OK so I am using this code to sorta make a small image host for me and my friends but its acting up........to start, here is my code
    Code:
    <?php
    
           if($_FILES['fild']['name']){
                   $file_path = $_FILES['fild']['tmp_name'];
                   $file_name = $_FILES['fild']['name'];
                   $file_size = $_FILES['fild']['size'];
                   $file_type = $_FILES['fild']['type'];
                   $file_error = $_FILES['fild']['error'];
    
                   if(is_uploaded_file($file_path)){
                           copy($file_path, $file_name) or die('There was an error while uploading your file. Please try again.');
                           echo('Your file has been uploaded.<br>Thank you!');
    					   echo ("<br>The URL is: rxrowley.6te.net/1/".$_FILES['fild']['name']); 					 
    					   }
           }else{
    ?>    
    
    <form method="post" enctype="multipart/form-data">
                     <input TYPE="file" name="fild">
                     <input name="submit" type="submit" value="Upload" />
    </form>
             <?php
           }
    ?>

    So, The image will upload just fine, but when I try to put in the URL, it does not work, the only way I can get the image to display is by making a link from a page.....hmmmm.......any takers?

  • #2
    New Coder
    Join Date
    Feb 2006
    Location
    Las Vegas
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I guess what im trying to do is in the echo that says the URL is.... to make it a link to the file, I just cant figure out how to write the code for a link in php

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    82
    Thanks
    3
    Thanked 0 Times in 0 Posts
    You don't need to put the echo statement in brackets. Also are you absolutely certain that the folder called '1' that is where the images are stored has read permissions set?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •