Reputation: 922
Just want to know if there's a java script code equivalent to PHP's move_uploaded_file function?
Upvotes: 0
Views: 614
Reputation: 2168
No, javascript does not have the ability to have files uploaded to it or to move them around on a disk.
Javascript is sandboxed, meaning that it cant do anything outside of its running context.
This is for obvious security reasons... mainly the risk that a malicious site would upload some sort of virus or other malware to your device and then move it somewhere on your device using pure javascript...
This would be bad.
Upvotes: 1
Reputation: 427
You need a server for file upload, the only thing you can do in javascript is an Ajax upload.
For example something like https://blueimp.github.io/jQuery-File-Upload/
Upvotes: 0