My problem is quite simple.
I am writing an uploader class in php and have decided to include support for ajax uploads.
Using firefox, I detected that a header X-File-Name is sent. I am using a 3rd party javascript library for the uploads, and it sends the filename in a query string to the php script.开发者_StackOverflow
What I wish to know is, is there a consistent means of getting the filename like through the X-File-Name that is consistent with all ajax requests or I need users to specify the name of the file.
I can ask users to specify, but I would love to have a consistent method.
Thanks.
It seems nothing is concrete in the world of xhr. I therefore resulted to using the X-File-Name
header if I found it but requiring a user submitted filename. Uploads are read from the input stream.
I believe $_FILES[inputname][name]
is what you're looking for, where inputname
is the name given to the file upload input box.
http://php.net/manual/en/reserved.variables.files.php
精彩评论