How to make own file upload using HTML and javascript

左心房为你撑大大i 提交于 2019-12-23 03:14:05

问题


I need to make new own file upload field using HTML and Javascript since Built-In file upload not showing full path of the file

I need to make it similar to file upload by using button and textbox

please help to solve this problem


回答1:


You can't.

There are security considerations browsers must adhere to and there is now way around that.

FYI this is also why Firefox doesn't allow drag and drop into a file field.




回答2:


Just fyi, I think the path display depends on your browser.

If you're willing to/can do so, java (not javascript) might be able to help you with your original problem. Java brings it's own problems, though.




回答3:


The file upload is a specific input type, which you can't easily replace, but in some browsers you may be able to style it.

You should be able to access the filename from javascript, and display this in a different part of the page (possibly hiding the file input at the same time) so the user can see what will be selected.

Another option is to use Flash for a fancier front-end (see http://www.flickr.com/photos/upload/ (assuming you have a flickr account) as an example), but I've never used one of these as a developer



来源:https://stackoverflow.com/questions/1635377/how-to-make-own-file-upload-using-html-and-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!