Filename cannot be empty

后端 未结 2 687
甜味超标
甜味超标 2021-01-27 01:49

I get this error everytime i hit the submit button. Everything else is submitted to the database, only the image isn\'t. Warning: file_get_contents(): Filename cannot be empty

2条回答
  •  没有蜡笔的小新
    2021-01-27 02:16

    In the $_FILES array, you've said you're getting [name]=>DSC_0770.JPG[type]=> [tmp_name]=>[error]=>1[size]=>0

    If tmp_name is not given, that means the file was not uploaded.

    The error you're given is 1, and according to the upload error messages explained page this means: that the uploaded file exceeds the upload_max_filesize directive in php.ini.

    You can do the following to fix this.

    • Find your php.ini file and increase the size of upload_max_filesize.
    • Use ini_set('upload_max_filesize', '20M'); or whatever size you want at the start of your script.
    • Compress your images before uploading.

提交回复
热议问题