Media module uploads error



  • When attempting to upload images via the Media module I'm getting an error seemingly when the file is moved from the temporary upload location to the public media directory. The exception flashes by quite quickly and I've had to take a screenshot in order to read it, but the important bits are as follows:

    ErrorException in FileService.php line 38
    fopen(): Filename cannot be empty

    1. at HandleExceptions->handleError('2', 'fopen(): Filename cannot be empty', 'C:\inetpub\localhost\test_project.com\Modules\Media\Services\FileService.php', '38', array('file' => object(UploadedFile), 'savedFile' => object(File), 'path' => 'public/assets/media/test_image.jpg'));

    An obvious concern is the IIS server and the translation of htaccess to web.config, however, I've been developing on it for several weeks now and have had no other problems. This test project is a fresh installation with the latest modules and no customisation.

    Has anyone else had this problem?



  • Update: Deployed the test project to an Ubuntu VM, works without issue.



  • Unsurprisingly, I suppose, the problem was due to permissions.

    The send() method of the XmlHttpRequest in dropzone.js was generating a 500 error. After scrabbling about with every other possibility for longer than I care to admit, I decided to check the user role. Turns out Authentication was working correctly, but for reasons I haven't yet determined Authorisation was failing even though the app pool user role had full permissions to the site's directory. The solution was to connect explicitly using my own credentials.



  • @Poxblossom

    I have the same issues in my project. can you please help to solve this issues. I am unable to fix this issues in asgardCMS. Thanks!


  • Global Moderator

    Hi,
    This has been working for more than a year.
    So there's like 99% chance permissions of server side or some funky setups or no image manipulation driver causes all the issues.

    • Enable GD
    • Fix permissions (you can use bindfs to have painless development)
    • Try manual image resize with pure php
    • If at this point still not working post an issue with steps to reproduce (os, server, php user, server user, permissions on a public folder etc.)


  • in FileService.php line 38
    at HandleExceptions->handleError('2', 'fopen(): Filename cannot be empty', 'C:\inetpub\wwwroot\vtekh\Modules\Media\Services\FileService.php', '38', array('file' => object(UploadedFile), 'savedFile' => object(File), 'path' => 'public/assets/media/add-innner5_5.jpg'))
    at fopen('', 'r+') in FileService.php line 38
    at FileService->store(object(UploadedFile)) in MediaController.php line 63
    at MediaController->store(object(UploadMediaRequest))
    at call_user_func_array(array(object(MediaController), 'store'), array(object(UploadMediaRequest))) in Controller.php line 256
    at Controller->callAction('store', array(object(UploadMediaRequest))) in ControllerDispatcher.php line 164
    at ControllerDispatcher->call(object(MediaController), object(Route), 'store') in ControllerDispatcher.php line 112
    at ControllerDispatcher->Illuminate\Routing{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
    at ControllerDispatcher->callWithinStack(object(MediaController), object(Route), object(Request), 'store') in ControllerDispatcher.php line 69
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'Modules\Media\Http\Controllers\Api\MediaController', 'store') in Route.php line 203
    at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
    at Route->run(object(Request)) in Router.php line 708
    at Router->Illuminate\Routing{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Router.php line 710
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675
    at Router->dispatchToRoute(object(Request)) in Router.php line 635

    I am getting this issue help me on this to upload media in asgard


  • Global Moderator

    @vinod-t

    Are you using some kind of windows setup?
    Judging by the paths it looks like it and AsgardCMS do not officially support Windows builds, at least no direct fixes or tests are beeing made for it.


Log in to reply
 

Looks like your connection to AsgardCms was lost, please wait while we try to reconnect.