icewind/smb 和 robgridley/flysystem-smb 与 laravel?

问题描述

我有一个 windows 共享文件夹,我的 Laravel 项目在 linux 服务器上,但我有使用 icewind 和 flysystem 的 ConnectionRefusedException。

我输入:

作曲家需要 icewind/smb 作曲家需要 robgridley/flysystem-smb

这是代码

public function uploadFile(Request $request){

        /*Initializing variables*/
        $input = $request->all();

        /*root*/
        $ruta_server = DIRECTORY_SEParaTOR.DIRECTORY_SEParaTOR.'172.xx.xx.xxx'.DIRECTORY_SEParaTOR.'Prueba';

        /*naming my file(.docx)*/
        if($request->hasFile('file')){
            /*Modificación en el nombre y extensión*/
            $file = $request->file('file');
            $filename = $file->getclientOriginalName();
            $filename = pathinfo($filename,PATHINFO_FILENAME);
            $name_file = str_replace(" ","_",$filename);
            $extension = $file->getClientOriginalExtension();

            /*Drafting or review*/
            if($input['posicion'] == 1){
                $picture = 'Redaccion('.$input['version'].')' . '-' . $name_file . '.' . $extension;
            }else{
                $picture = 'Revision('.$input['version'].')' . '-' . $name_file . '.' . $extension;
            }

            /*Connection and the problem that I can't solve*/
            $factory = new ServerFactory;
            $auth = new BasicAuth($input['user'],$input['group'],$input['pass']);
            $server = $factory->createServer($ruta_server,$auth);
            $share = $server->getShare('DOCUMENTOS');
            $filesystem = new Filesystem(new SmbAdapter($share));
            
            /*upload*/
            $response = $filesystem->put($ruta_server,$picture);

            return response()->json([
                "ok" => true,"error" => false,"data" => $picture
            ]);
        }else{
            return response()->json([
                "ok" => false,"error" => true,"mensaje" => "Error Detectado"
            ]);
        } 
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)