我在上传前进行客户端图片大小调整。 FileUploader元素的标准行为将获取指定的文件并按原样提交。我有一个blob,其中包含已调整大小的所选图像,可以上传。如何在FileUploader中设置此blob并确保它没有采用原始文件?
答案 0 :(得分:0)
使用现代浏览器,我会发送<head>[enter image description here][1]
<link rel="stylesheet" type="text/css" media="all" href="http://www.edak.cf/select_date_ir/datepicker.css" >
</head>
<body>
****<form action="" method="post">
<div class="input-dte">
From : <input id="inputpickerr" class="input" name="From" type="text" placeholder="JALALI DATE" />
To: <input id="inputpicker" class="input" name="To" type="text" placeholder="JALALI DATE" />
<input name="submit" type="submit" />
</div>
</form>****
<script type="text/javascript" src="http://www.edak.cf/select_date_ir/jalali.js"></script>
<script type="text/javascript" src="http://www.edak.cf/select_date_ir/calendar.js"></script>
<script type="text/javascript" src="http://www.edak.cf/select_date_ir/calendar-setup.js"></script>
<script type="text/javascript" src="http://www.edak.cf/select_date_ir/calendar-fa.js"></script>
<script type="text/javascript">
Calendar.setup({
inputField: "inputpicker", // id of the input field
inputField: "inputpickerr", // id of the input field
button : "inputpicker", // trigger for the calendar (button ID)
button : "inputpickerr", // trigger for the calendar (button ID)
ifFormat : "%Y-%m-%d", // format of the input field
dateType : 'jalali',
weekNumbers : false
});
</script>
</body>
JavaScript本地XMLHttpRequest
:(对于浏览器兼容性检查send(FormData)
)
Blob
它发送与FileUploader相同的请求。
在FileUploader组件中没有设置文件的方法。
可以访问文件var oReq = new XMLHttpRequest();
oReq.open("POST", sUploadUrl, true);
oReq.onload = function (oEvent) {
// Uploaded.
};
var oFormData = new FormData();
oFormData.append("myFileUpload", blob);
oReq.send(formData);
中包含在组件中的文件输入,但它会使组件的内部状态不一致。