Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 视频上传错误instagram api mgp25_Php_Laravel 5.2_Instagram Api - Fatal编程技术网

Php 视频上传错误instagram api mgp25

Php 视频上传错误instagram api mgp25,php,laravel-5.2,instagram-api,Php,Laravel 5.2,Instagram Api,我正在使用instagram api上传图像和视频,图像正在发布,工作正常,但问题在于视频上传。扔掉这个例外。 在控制器中,图像post正在工作,但视频post不工作 错误是。 JsonMapper::map()要求第一个参数是对象,给定NULL 我的ajax上传方法是 if($('#iCheck').is(':checked')){ $.ajax({ type:'POST', url:'instagram/write',

我正在使用instagram api上传图像和视频,图像正在发布,工作正常,但问题在于视频上传。扔掉这个例外。 在控制器中,图像post正在工作,但视频post不工作

错误是。 JsonMapper::map()要求第一个参数是对象,给定NULL

我的ajax上传方法是

if($('#iCheck').is(':checked')){
        $.ajax({
            type:'POST',
            url:'instagram/write',
            data:{
                'caption':status,
                'image':image,
                'video':video
            },
            success:function (data) {
                count = count - 1;
                if (count == 0) {
                    loading.hide(100);
                }


                if (data == 'success') {
                    $('#iMsgSu').show(300);
                }
                else {
                    $('#iMsgEr').html(data);
                    $('#iMsgEr').show(300);
                }
                console.log(data);
                count = count - 1;
                if (count == 0) {
                    loading.hide(100);
                    var sentData = fbId + '_' + twId + '_' + tuId + '_' + wpId;
                    postSave(sentData);
                    $('#final').val(sentData);
                }
            }
        });
    }
public function write(Request $request)
    {
        try {
            $image = $request->image;
            $video = $request->video;

            if ( $image ) {
                $this->instagram->uploadPhoto(public_path() . "/uploads/" . $request->image, $request->caption);
            }
            if ( $video ) {
                $this->instagram->uploadVideo(public_path() . "/uploads/videos/" . $request->video, $request->caption);
            }
            return "success";
        } catch (\Exception $exception) {
            return $exception->getMessage();
        }

    }
我的控制器方法是

if($('#iCheck').is(':checked')){
        $.ajax({
            type:'POST',
            url:'instagram/write',
            data:{
                'caption':status,
                'image':image,
                'video':video
            },
            success:function (data) {
                count = count - 1;
                if (count == 0) {
                    loading.hide(100);
                }


                if (data == 'success') {
                    $('#iMsgSu').show(300);
                }
                else {
                    $('#iMsgEr').html(data);
                    $('#iMsgEr').show(300);
                }
                console.log(data);
                count = count - 1;
                if (count == 0) {
                    loading.hide(100);
                    var sentData = fbId + '_' + twId + '_' + tuId + '_' + wpId;
                    postSave(sentData);
                    $('#final').val(sentData);
                }
            }
        });
    }
public function write(Request $request)
    {
        try {
            $image = $request->image;
            $video = $request->video;

            if ( $image ) {
                $this->instagram->uploadPhoto(public_path() . "/uploads/" . $request->image, $request->caption);
            }
            if ( $video ) {
                $this->instagram->uploadVideo(public_path() . "/uploads/videos/" . $request->video, $request->caption);
            }
            return "success";
        } catch (\Exception $exception) {
            return $exception->getMessage();
        }

    }

您必须实现
ffprobebin
ffmpeg
才能通过
mgp25
instagram API上传视频

\InstagramAPI\Utils::$ffprobeBin = 'Directory\Instagram-Project\FFmpeg\ffprobe.exe';
\InstagramAPI\Utils::$ffmpegBin = 'Directory\Instagram-Project\FFmpeg\ffmpeg.exe';

如果您想要php示例,我可以发送。

您的服务器的上载限制是多少?检查您的apache/nginx配置,以及您的php.ini-值是多少?服务器上载限制为30 MB,而我尝试上载的文件大小为5 MB。请发送给我好吗?jabbasov020@gmail.com