3

I am trying to use Ajax and the FormData() object to send a file (as a blob) and it's full path and name to the server. I can do this with a simple file name ("Page1.htm") but if I send any sort of path it gets stripped out and just the base file name is left. How can I send a whole path and file name?

Client-side Javasctipt:

var pageblob = new Blob([pagecontent)], {type: "text/html"});
var formdata = new FormData();
formdata.append("Page", pageblob, "/path/pagename.htm");

Server-sdie PHP:

echo $_FILES["Page"]["name"];
NickC
  • 1,253
  • 5
  • 16
  • 23
  • See http://stackoverflow.com/questions/5450713/getting-complete-path-of-uploaded-file-php – guest271314 Aug 14 '16 at 19:56
  • 1
    you can't get/set the full path for security reasons, but you can use a 2nd "input" to ship that string to the server. – dandavis Aug 14 '16 at 21:07
  • guest271314: Looked at that thread but it still doesn't show any way of passing a path along with the file. – NickC Aug 15 '16 at 11:12
  • dandavis: Thats what I can't seem to get working, no matter how I try I cannot seem to get a second parameter being passed along with the file. – NickC Aug 15 '16 at 11:13

0 Answers0