SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Savar, Dhaka.
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Is it possible to insert value in input type="file" ?

    Hi,
    Can anyone tell me how to insert value in input type="file" ?
    If anyone knows please reply.
    Thanks.

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    No, it is forbidden due to the possible security implications.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Location
    Savar, Dhaka.
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then how to retrieve data from database for an image ?

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is normally done by:
    - Display the image from the database in <IMG> tag
    - Have another file browse field for changing the new one.

    Hope you understand what I mean!
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,011
    Mentioned
    56 Post(s)
    Tagged
    0 Thread(s)
    That (getting file information for an uploaded file) is possible. When a file is uploaded a superglobal called $_FILES will be populated. It contains information on the file's size, where it was stored in the tmp file system (you'll have to move it from there to your database or permanent file system storage), and the mime type.

    PHP Manual entry on handling file uploads.

  6. #6
    SitePoint Enthusiast
    Join Date
    Dec 2011
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not possible to have the value of file path in your upload form pre-populated.
    If it was possible someone could write a form that pre-populates file input with a path to some private file on your computer, then if you don't notice it an press "submit" it would just grab your file and send it to their server.

  7. #7
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,011
    Mentioned
    56 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ultra1 View Post
    It's not possible to have the value of file path in your upload form pre-populated.
    If it was possible someone could write a form that pre-populates file input with a path to some private file on your computer, then if you don't notice it an press "submit" it would just grab your file and send it to their server.
    And that wouldn't even be that hard since file architectures are fairly predictable - especially Windows and Mac - Linux less so due to all the distros floating about.


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
  •