存档

11月 2021

显示总共32条中的前3条

flutter dio upload image type application/octet-stream to image/jpeg
发布者 : 粮油菜大市场 发布时间 : 29 Nov 2021 06:56:02
   MediaType? mediaType;
    if (_fileToUpload.path.endsWith('jpg') ||
        _fileToUpload.path.endsWith('jpeg')) {
      mediaType = MediaType("image", "jpeg");
    } else if (_fileToUpload.path.endsWith('png')) {
      mediaType = MediaType("image", "png");
    }
    if (_fileToUpload.path.isNotEmpty) {
      // Create a FormData
      String fileName = basename(_fileToUpload.path);

      print("File Name : $fileName");
      print("File Size : ${_fileToUpload.lengthSync()}");
      print("File Type : $mediaType");
      _formData = FormData.fromMap({
        "product_images": await MultipartFile.fromFile(_fileToUpload.path,
            filename: fileName, contentType: mediaType)
      });
    }
 
解决方案就是更改contentType参数
Invalid configuration value: failovermethod=priority dnf upgrade
发布者 : 粮油菜大市场 发布时间 : 29 Nov 2021 04:59:11

dnf upgrade

Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/webtatic.repo; Configuration: OptionBinding with id "failovermethod" does not exist

 

just remove these old yum repository

 

rpm -qf /etc/yum.repos.d/webtatic.repo;

webtatic-release-7-3.noarch

[root@mb-clone-001 tmp]# yum remove webtatic-release-7-3.noarch

 

Yii3.0 can’t upload files with only a file name with httpsoft message fileupload
发布者 : 粮油菜大市场 发布时间 : 29 Nov 2021 04:43:41

 

I/flutter ( 4124):       ["size":"HttpSoft\Message\Stream":private]=>

I/flutter ( 4124):       NULL

I/flutter ( 4124):       ["seekable":"HttpSoft\Message\Stream":private]=>

I/flutter ( 4124):       NULL

I/flutter ( 4124):       ["writable":"HttpSoft\Message\Stream":private]=>

I/flutter ( 4124):       NULL

I/flutter ( 4124):       ["readable":"HttpSoft\Message\Stream":private]=>

I/flutter ( 4124):       NULL

I/flutter ( 4124):     }

I/flutter ( 4124):     ["file":"HttpSoft\Message\UploadedFile":private]=>

I/flutter ( 4124):     NULL

I/flutter ( 4124):     ["size":"HttpSoft\Message\UploadedFile":private]=>

I/flutter ( 4124):     int(508081)

I/flutter ( 4124):     ["error":"HttpSoft\Message\UploadedFile":private]=>

I/flutter ( 4124):     int(0)

I/flutter ( 4124):     ["clientFilename":"HttpSoft\Message\UploadedFile":private]=>

I/flutter ( 4124):     string(35) "image_picker2327524825930727230.jpg"

I/flutter ( 4124):     ["clientMediaType":"HttpSoft\Message\UploadedFile":private]=>

I/flutter ( 4124):     string(24) "application/octet-stream"

I/flutter ( 4124):     ["isMoved":"HttpSoft\

 

 

it seems there is problems with my server,
can’t create tmpfile() when upload, i will check ,thank you

it worked after set php upload_tmp_dir
and upgrade the system, now php version is 8.0.9
i don’t know what make it works

 

搬到新服务器从App上传图片一样,也没反应,报错也没有,还好想起来以前好像发生过,一搜索还找到了当初发的贴子,确实是upload_tmp_dir没设置的问题,按道理有默认的位置啊

https://forum.yiiframework.com/t/yii3-0-cant-upload-files-with-only-a-file-name/132717/2