PHP move_uploaded_file function errors in Safari but works in Chrome -


the following code uploads image in chrome browser fails in safari. safari up-to-date , cookies allowed. going wrong?

<form action="" method="post" accept-charset="utf-8" enctype="multipart/form-data"> <div class="upload-btn-wrapper">                   <button class="btn-2"><i class="fa fa-camera" aria-hidden="true"></i>select image</button>                   <input type="file" name="avatar"  id="avatarbtn"/>                 </div>  <button type="submit" name="usdet-1" class="btn-2" style="margin-top: 20px;">save details</button> </form>  <?php $edavatar = $_files['avatar']['name']; $filetmploc = $_files["avatar"]["tmp_name"]; $filetype = $_files["avatar"]["type"]; $filesize = $_files["avatar"]["size"]; $fileerrormsg = $_files["avatar"]["error"];  $kaboom = explode(".", $edavatar); $fileext = end($kaboom);  $newfilename = rand(10,999999999999).".".$fileext;  $folder ='doc/users/user-folder/profile/img';  $moveresult = move_uploaded_file($filetmploc, "$folder/$newfilename");  if ($moveresult != true)  {     // profile image upload failed, occurs on safari browser only.  } else {     // works fine on chrome browser        } ?> 

var_dump($_files) result below

array(1) { ["avatar"]=> array(5) { ["name"]=> string(15) "profile_img.jpg" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(14) "/tmp/php9yha7d" ["error"]=> int(0) ["size"]=> int(161313) } }


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -