1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

File Input Get Contents

Discussion in 'PHP' started by Pudge1, Aug 13, 2009.

  1. #1
    When you use a <input type="file" /> for file uploads is there anyway to get the text that is written inside the box for example C:\Documents and Settings\Matthew\Desktop\Images\image.png?
     
    Pudge1, Aug 13, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    kblessinggr, Aug 13, 2009 IP
  3. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #3
    That is completely unrelated to what I am talking about... You know the <input type="file" /> when you are uploading files? I want to get the text that is in there like the C:\...
     
    Pudge1, Aug 13, 2009 IP
  4. stOK

    stOK Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    $_FILES['userfile']['name']
    The original name of the file on the client machine.
     
    stOK, Aug 13, 2009 IP
  5. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's all a matter of how you word your question, since 'box' could be misinterpreted as trying to say trying to get text into an image, or out of an image, and not 'original file name'. Though $_FILES['userfile']['name'] will only contain the name of the file as uploaded it won't contain the full path of the local file system it was selected from. (meaning filename.png, not C:\...\...\filename.png)
     
    kblessinggr, Aug 13, 2009 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    php wont allow you to do this i guess i mean if u use the function it will be done directly using the tmp_name
     
    Bohra, Aug 13, 2009 IP
  7. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #7
    When I use filesize($_FILES['upload']['name']); why does it not find out the file is too big before it uploads it.
     
    Pudge1, Aug 13, 2009 IP
  8. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #8
    php wont check the size of file before upload.. u can probably use cgi/perl
     
    Bohra, Aug 13, 2009 IP
  9. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #9
    But then I would have to rewrite my whole entire script.
     
    Pudge1, Aug 13, 2009 IP
  10. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #10
    Bohra, Aug 13, 2009 IP
  11. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #11
    I don't want to use flash though. Is there anyway you can do it via JavaScript or VBScript?
     
    Pudge1, Aug 13, 2009 IP
  12. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Javascript and VBScript for security reasons are not allowed to access the file system in that manner.

    So you're stuck with Java (not javascript), Flash or ActiveX for client-side file access.

    (You wouldn't want to use VBScript or ActiveX anyways since that would only work for Windows, and specifically Internet Explorer)
     
    kblessinggr, Aug 13, 2009 IP
  13. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #13
    Flash is the only way out of this if u want it to be like that
     
    Bohra, Aug 13, 2009 IP
  14. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Course could be like youtube and all the other social sites, offering the flash uploader as the default but a legacy version available as well (but in big bold telling you can't upload a file bigger than such and such, but the whole thing would still need to be uploaded before it could bite back).
     
    kblessinggr, Aug 13, 2009 IP
  15. scofider

    scofider Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    The original name of the file on the client machine.
     
    scofider, Aug 13, 2009 IP
  16. superdav42

    superdav42 Active Member

    Messages:
    125
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #16
    Why would you want to know the original path name on the client's machine anyway?
     
    superdav42, Aug 13, 2009 IP
  17. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #17
    Because I thought you could use filesize(C:\) to find out the size of the file before you uploaded it.
     
    Pudge1, Aug 14, 2009 IP
  18. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Naturally a serversided language has no direct access to the client's file system, it would otherwise be extremely insecure.

    I wouldn't get too annoyed, even the big boys like youtube and microsoft have to resort to either flash or activeX controls to do what you wanted to do without using those items.
     
    kblessinggr, Aug 14, 2009 IP
  19. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #19
    Your only two options are Flash or Java (not javascript, but an actual Java applet which works pretty much like Flash does) if you want to support anything other than Internet Explorer.
     
    joebert, Aug 15, 2009 IP
  20. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #20
    Which one would be less obvious that it is made out of a language like that?
     
    Pudge1, Aug 16, 2009 IP