Getting the Full Path Of A File Upload Field In A Form in PHP

后端 未结 2 1041
隐瞒了意图╮
隐瞒了意图╮ 2021-01-20 18:00

I am using a file upload in PHP. I want to get the Full PATH of the File Selected. Is there any way i can get the full path in PHP??

For Eg: i uploaded a image fro

相关标签:
2条回答
  • 2021-01-20 18:30

    On the client side fileinput.value will give just the filename in Firefox and the full path in IE8. No browser will send the full path to the server as that would be a security issue.

    However with IE (I've done this with IE8*) you can probably cheat a bit with JavaScript and put the path into a different text field to be sent with the form. Of course that would only work for IE. I would argue IE is broken since it allows you to do such nasty things.

    *I wasn't sending the path to the server. I was creating a "stylish" file upload control for which I cheated by putting the selected filename in a separate text field and hid the actual file input. IE and FF differed in how the filename was displayed

    0 讨论(0)
  • 2021-01-20 18:33

    You probably can't. Many browsers these days don't send that information, as it can give attackers information about the user's system.

    0 讨论(0)
提交回复
热议问题