There is an error reported in $name and I don't know the reason.
❤非酋
❤非酋 2017-08-22 16:39:40
0
4
1677

$name I didn’t follow the example. What I wrote was $name=date('Y-m-d h:i:s').".".Tail variable

Then it prompted failed to open stream: Invalid argument in, if I remove the date, it will be fine. What did I do wrong?

❤非酋
❤非酋

reply all(4)
逸先生
代码没问题,应该是目标路径的问题,更改一下路径或者添加./试一试
猪哥

Post the error message. rand(0,10).'.'.$lastimg; The code here is wrong. Change it to rand(0,10).$lastimg;

Reply


  • reply $lastimg actually equals jpg, so there is definitely no problem with the . in the middle. There is a problem just because the previous date is added.
    ❤非酋 author 2017-08-23 15:08:30
  • reply Warning: move_uploaded_file(upload/images/2017-08-23 15:09:066.jpg): failed to open stream: Invalid argument in D:phpStudyWWWfile.php on line 40 Warning: move_uploaded_file(): Unable to move 'C:UsersAdministratorAppDataLocalTempphp2872.tmp' to 'upload/images/2017-08-23 15:09:066.jpg' in D:phpStudyWWWfile.php on line 40 上传失败 这是报错信息
    ❤非酋 author 2017-08-23 15:09:47
ringa_lee

What you are reporting is an error in the parameters of the date function

  • reply But what's wrong with date? There is no problem if I output this date ('Y-m-d H:i:s') alone~
    ❤非酋 author 2017-08-23 15:11:00
  • reply But what's wrong with date? There is no problem if I output this date ('Y-m-d H:i:s') alone~
    ❤非酋 author 2017-08-23 15:11:02
  • reply But what's wrong with date? There is no problem if I output this date ('Y-m-d H:i:s') alone~
    ❤非酋 author 2017-08-23 15:11:03
  • reply Do important things need to be said three times? --! Then take a look at your entire code post. If this is correct, then it must be the mistake behind it.
    ringa_lee author 2017-08-23 16:32:22
Peter_Zhu

date('Y-m-d H:i:s), pay attention to capitalization

  • reply I modified it as you said, but it still doesn't work. These are a few lines of code. Lastimg is the original one. There is no problem with this. $name=date('Y-m-d H:i:s').rand(0,10).'.'.$lastimg; if (is_uploaded_file($_FILES['file']['tmp_name'])) { if (move_uploaded_file($_FILES['file']['tmp_name'], $path .$name)) {
    ❤非酋 author 2017-08-23 10:25:18
  • reply $name=date('Y-m-d H:i:s').rand(0,10).'.'.$lastimg; if (is_uploaded_file($_FILES['file']['tmp_name'])) { if (move_uploaded_file($_FILES['file']['tmp_name'], $path .$name)) {
    ❤非酋 author 2017-08-23 10:25:51
  • reply Post the error message. rand(0,10).'.'.$lastimg; The code here is wrong. Change it to rand(0,10).$lastimg;
    PHP中文网 author 2017-08-23 11:50:00
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template