javascript - Filemask using new dojo Uploader -


I created a DOJO browse button to upload files to the server. The button works fine however I want to be able to restrict * .jpg files only to my file selection. In DOJO dojox.form.FileUploader I could use the file mask attribute to upload / select mask files to the server. Example:

  var file mask = ["images", "* .jpg; * .jpeg; * .gif; * .png"] var uploader = new dojox.form.FileUploader ({ Button: Dijit.byId ("myFakeButton"), upload url: uploadUrl, file mask: file mask});   

However the dojox.form.FileUploader is now deprecated (to be downgraded soon) and has been replaced by dojo.form.uploader. In this I am unable to find any property that could duplicate the maximum capacity of the file. I have read but it does not mention anything about file masks.

Did anyone face this issue?

You can set the type by the accept attribute and configure it Mime type can

  dojo.require ("dojox.form.Uploader"); Var tbl = document.getElementById ('hola'); Var fileInput = document.createElement ('Input'); FileInput.type = 'file'; // Fallback file input.setibibet ("data-dojo-type", "dosox form. Uploader"); FileInput.setAttribute ('Accept', 'Image / JPEG'); FileInput.setAttribute ('Data-Dojo-Props',' Name: "Uploaded file", label: "Select some files"); Tbl.appendChild (fileInput);   

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -