Archived from the Transloadit support forum. Originally posted on November 22, 2011; details may be outdated, see our docs for current behavior. Original thread
I’m curious if it’s possible to prevent empty uploads with the jQuery plugin. If a file field has no file selected, why is it attempting to upload and process an empty file to Transload.it? In my app, when a user edits a resource but chooses not to change the attached image then an empty file is uploaded and ends up replacing the existing image. Obviously, I could handle this empty result on my backend, but I’d rather just get to the root and have the form submitted without any transloadit interaction when it’s unnecessary.
I’m sorry, I think I misspoke. My attachments aren’t getting overwritten, but the transloadit modal still pops up when there is no file in a file field, which still results in an assembly being created. It also means the moment a user clicks submit on a form with a file field they have to wait an extra few seconds for the jquery plugin to upload empty data. As an example, visit http://transloadit.com/demos/image-resize/resize-to-75x75 and simply press “Upload”. What I would prefer to see in the case of that example is that the jQuery plugin is never engaged if the file field is empty. I’ve tried attaching the jQuery plugin conditionally on the form’s submit event, but it doesn’t seem to work.
Is it possible for the jQuery plugin to just let a form submit normally if the file field is empty?