I am using tiny mce to upload images to a server, I need help with writing the image upload handler for it. This is what I have so far: TinyMce script -
tinymce.init({
selector: "textarea",
height: 450,
theme: "modern",
paste_data_images: false,
plugins: "table,link,textcolor,lists,image"
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
images_upload_url: 'handleImageUpload.asp',
automatic_uploads: true,
file_picker_types: 'image',
file_picker_callback:function (cb, value, meta) {
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', 'image/*');
input.onchange = function () {
var file = this.files[0];
var reader = new FileReader();
reader.onload = function () {
var id = 'blobid' + (new Date()).getTime();
var blobCache = tinymce.activeEditor.editorUpload.blobCache;
var base64 = reader.result.split(',')[1];
var blobInfo = blobCache.create(id, file, base64);
blobCache.add(blobInfo);
/* call the callback and populate the Title field with the file name */
cb(blobInfo.blobUri(), { title: file.name });
};
reader.readAsDataURL(file);
};
input.click();
},
And my handleImageUpload.asp so far goes like this -
<%@ language="VBScript" %>
<% option explicit %>
<%
dim fs,f,sFiles
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateFolder(Server.MapPath("/images"))
sFiles = Request.Files("file")
%>
The issue is Request.Files("file")
doesn't return the image data that is to be uploaded. Any help will be appreciated.
Thanks.