简体   繁体   English

自定义上传图像 <a></a> 在HTML

[英]Uploading images with customizing <a></a> in html

I'm a newbie in html and trying to upload image to my homepage. 我是html的新手,正在尝试将图像上传到我的主页。

I already set up the uploading part like below in html, 我已经像下面的html一样设置了上传部分,

<div class="collapse navbar-collapse" id="navbar-collapse">
  <ul class="nav navbar-nav navbar-right">
     <li>
       <form action="/upload", method="post", enctype="multipart/form-data">
         <input type="file" style="max-width: 30%; max-height: 50%;"  name="upFile" id="upFile" onchange="getCmaFileView(this,'name')" target="dropzone_1">
         <input type="submit" name="Upload" >
       </form>
     </li>
     <li>
       <form action="/jsondata", method="get", id="jsd", enctype="multipart/form-data"  ></form>
     </li>
     <li><a onclick="save2()" id="imageSave">Save</a></li>
  </ul>

However, it shows a button like old-fashioned typical button like below, 但是,它显示的按钮类似于老式的典型按钮,如下所示,

在此处输入图片说明

and I want it to make my own customized button using with clicking.. 我希望它通过单击来制作我自己的自定义按钮。

I tried to find in google, but they used <div> instead of <form> of mine.. So I posted here customize the file button for image upload 我尝试在Google中查找,但他们使用的是<div>而不是我的<form> 。所以我在这里发布了自定义文件按钮以上传图片

I know this might be a stupid question, but I just want to learn! 我知道这可能是一个愚蠢的问题,但我只想学习!

How can I make that...? 我该怎么做...?

Thanks in advance! 提前致谢!

Here is working example how to style your upload button. 这是如何设置上传按钮样式的有效示例。 Basically you have to hide your html input. 基本上,您必须隐藏html输入。

 .fileUpload { position: relative; overflow: hidden; margin: 10px; } .fileUpload input.upload { position: absolute; top: 0; right: 0; margin: 0; padding: 0; font-size: 20px; cursor: pointer; opacity: 0; filter: alpha(opacity=0); } 
 <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <div class="fileUpload btn btn-success"> <span>Click to upload new file</span> <input type="file" class="upload" /> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM