Kentico Media Upload "The system cannot find the file specified"

Anna Pengal asked on November 3, 2020 21:55

We have Kentico configured to use AWS for storing files in the media library, but when we go to upload a file to the media library it makes it to 100% and throws the error "The system cannot find the file specified".

The event log isn't much help with this as the detail of the error: "Message: The system cannot find the file specified

Exception type: System.ComponentModel.Win32Exception
Stack trace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Dianoga.Optimizers.CommandLineToolOptimizer.ExecuteProcess(String arguments)
at Dianoga.Optimizers.CommandLineToolOptimizer.ProcessOptimizer(OptimizerArgs args)
at Dianoga.Optimizers.OptimizerProcessor.Process(OptimizerArgs args)
at Dianoga.Jpeg.JpegOptimizer.ProcessStream(Byte[] imageBytes)
at Dianoga.Jpeg.JpegOptimizer.Optimize(MediaFileInfo file)
at Dianoga.MediaOptimizer.Process(MediaFileInfo stream)
at Dianoga.MediaOptimizer.MediaFile_Insert_Before(Object sender, ObjectEventArgs e)
at CMS.Base.AbstractHandler.CallEventHandler[TArgs](EventHandler`1 h, TArgs e)
at CMS.Base.AbstractHandler.Raise[TArgs](String partName, List`1 list, TArgs e, Boolean important)
at CMS.Base.AdvancedHandler`2.RaiseBefore(TArgs e)
at CMS.Base.AdvancedHandler`2.RaiseBefore(TArgs e)
at CMS.Base.AdvancedHandler`2.StartEvent(TArgs e, Boolean allowEvent)
at CMS.DataEngine.ObjectHandler.StartEvent(BaseInfo obj)
at CMS.DataEngine.AbstractInfoBase`1.InsertData()
at CMS.DataEngine.AbstractInfoProvider`3.SetInfo(TInfo info)
at CMS.MediaLibrary.MediaFileInfoProvider.SetMediaFileInfoInternal(MediaFileInfo mediaFile, Boolean saveFileToDisk, Int32 userId, Boolean ensureUniqueFileName)
at CMS.MediaLibrary.Web.UI.MediaLibraryUploader.HandleMediaLibraryUpload(UploaderHelper args, HttpContext context)"

Does anyone know what the actual problem may be or how to resolve it?

Correct Answer

Dmitry Bastron answered on November 4, 2020 10:31

Hi Anna,

Actually, the error message is quite good clue! I think you are using DIanoga package for image optimization (this one or previous versions). As far as I remember, it might not be compatible with media files stored on AWS or Azure. The main reason is that it uses System.IO library instead of CMS.IO to work with files (refer here). What you can do, is download sources of Dianoga library and fix it. Or uninstall Dianoga.

If you are using Kentico 11 and higher you can also consider using ImageMagick instead (here is my blog post).

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.