You MUST use some kind of server-side language (like PHP, ASP or many others) to upload files. There’s no walkaround for that.
Think about it this way – javascript code runs on the client’s machine.. it doesn’t really care which server is hosting the website. So if this was doable using javascript only you should have been able to upload a file to any server.. not just the one you own. This is a security issue. Your server must be “ready” to receive the file and handle it properly such as validating the format of the file, limiting size, placing it in the right directory and changing it’s name etc..
Even if you would like to do it without refreshing the page you will have to create some server-side file such as upload.php
and use an AJAX request to upload the file to the server..
Valum’s File Uploader is an opensource project that deals with ajax file uploading. You can use it as a plugin.
9
solved Upload image or file with jquery function just with it no php no more codes needed? [closed]