SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    $HTTP_POST_FILES Help

    Hi, I am trying to use a form element I have sent from a form on my site. The form element is a file element (the user browses for a file) then clicks submit. I do not want to upload the file but rather use the entire path and file in text on the page it is sent to. I know if I use $HTTP_POST_FILES I have to have an array element on the end but I cant figure out which one will display the exact terms that were submitted. IE if the user found the file "C:/my_pictures/picture1.jpg" I want to be able to use the exact phrase "C:/my_pictures/picture1.jpg" on the page it is submitted to.

    Form:
    HTML Code:
     </form>
      <form action="[url="http://abilities.spotlyrics.com/resize.php"]http://abilities.spotlyrics.com/resize.php[/url]" method="post" enctype="multipart/form-data" name="form1">
    	  <input type="file" name="file">
    	  <input type="submit" name="Submit" value="Submit">
    	  <input name="Reset" type="reset" id="Reset" value="Reset">
    </form>
    Any help or suggestions is greatly apreciated.

    Thanks, Chris
    http://abilities.spotlyrics.com
    Thanks, Chris
    -------------------------
    http://spotlyrics.com
    -------------------------

  2. #2
    SitePoint Guru
    Join Date
    Feb 2004
    Location
    Oregon
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can't. once the user presses submit it uploads the file. then php puts the file in a tmp folder. you do not see the path they got it from.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ok

    Is there any way to access the image (that is what they are using the file path too) while it is in the temp dir?

    Here's what I am trying to do. My server does not have a GD libraray for editing images but I want to be able to have automatic thumbnails created. So my of my friends whos server does support GD library put a PHP script that will resize an image and display the output. All I have to do is specify the image but I would like it to be as automatic as possible and my website users must be able to use it. So I need to be able to have the users find the file on their local machine and then from there pass that file to my script on a seperate server by using the following code.

    Code:
    <img src="http://mysite.com/phpThumb.php?src={this is where the fiels goes}&w=100">
    Any ideas or suggestions?
    Thanks, Chris
    -------------------------
    http://spotlyrics.com
    -------------------------

  4. #4

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you really only want to get the local filename, you could set up the form without the enctype attribute. After the form was submitted you can get the full path by accessing $_POST['file'] ($_FILES['file'] will not work in this case), however the file will not be uploaded and it only works with IE and Opera. Gecko based browsers (Netscape 7, Mozilla, Firefox) only submit the filename without the path. The easiest way however would probably be to provide an input field where the user actually enters the filename with the path.


Bookmarks

Posting Permissions

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