我使用html5画布来拖放文件上传,但我需要使用已删除的文件发送其他信息。特别是记录ID。我将我的文件发送到php,如下所示:
canvasData = canvas.toDataURL('image/jpeg');
var ajax = new XMLHttpRequest();
ajax.open("POST", './php/uploadImage.php', false);
ajax.setRequestHeader('Content-Type', 'application/upload');
ajax.send(canvasData);
如何在文件中添加recordID=recordID的附加参数?
您可以将其作为URL查询参数发送:
ajax.open('POST', './php/uploadImage.php?recordID' + recordID, false);
我用修复了它
ajax.open("POST", './php/uploadImage.php?recordID=' + recordID, false);
ajax.setRequestHeader('Content-Type', 'application/upload');
ajax.send('recordID='+recordID+'&'+canvasData);