Change path of uploaded files in zip
I finally found the solution, instead of 

$zip-&gt;addFile($file_path, $media-&gt;entity-&gt;field_media_image-&gt;entity-&gt;name);


I simply put 

$zip-&gt;addFile($file_path, basename($file_path));


and it does the job.