title: Move record with laravel move_uploaded_file(): Unable to move
body: <p>I'm recording with script voice record and its saved to db but not moving to the public folder
  i've dd every single code and its working but don't know why the method of moving not working and when i dd($file); all the info and file type correct,method linked to api.php and route working correctly but cannot find out the problem in moving
  Error</p>
  <pre><code>Symfony\Component\HttpFoundation\File\Exception\FileException: Could not move the file &quot;C:\xampp\tmp\phpA7EA.tmp&quot; to &quot;records\2022-04-13T12:01:58.276Z.wav&quot; (move_uploaded_file(): Unable to move &amp;quot;C:\xampp\tmp\phpA7EA.tmp&amp;quot; to &amp;quot;records\2022-04-13T12:01:58.276Z.wav&amp;quot;). in file C:\xampp\htdocs\blog\vendor\symfony\http-foundation\File\UploadedFile.php on line 191
  </code></pre>
  <p>Controller</p>
  <pre><code>public function upload_record(Request $request)
      {
  
          if($request-&gt;file('recorder')){
  
                      $file=$request-&gt;file('recorder');
  
  
                    $name =$file-&gt;getClientOriginalName();
                    dd($name);
  
                    $file-&gt;move('records', $name);
          }
      }
  </code></pre>
  <p>Script</p>
  <pre><code>
      &lt;script src=&quot;http://cdn.rawgit.com/mattdiamond/Recorderjs/08e7abd9/dist/recorder.js&quot;&gt;&lt;/script&gt;
  
      &lt;script&gt;
          //webkitURL is deprecated but nevertheless
          URL = window.URL || window.webkitURL;
  
          var gumStream; //stream from getUserMedia()
          var rec; //Recorder.js object
          var input; //MediaStreamAudioSourceNode we'll be recording
  
          // shim for AudioContext when it's not avb.
          var AudioContext = window.AudioContext || window.webkitAudioContext;
          console.log(AudioContext);
          var audioContext //audio context to help us record
  
          var recordButton = document.getElementById(&quot;recordButton&quot;);
          var stopButton = document.getElementById(&quot;stopButton&quot;);
          var pauseButton = document.getElementById(&quot;pauseButton&quot;);
          //add events to those 2 buttons
          recordButton.addEventListener(&quot;click&quot;, startRecording);
          stopButton.addEventListener(&quot;click&quot;, stopRecording);
          pauseButton.addEventListener(&quot;click&quot;, pauseRecording);
  
          function startRecording() {
              console.log(&quot;recordButton clicked&quot;);
  
              /*
               Simple constraints object, for more advanced audio features see
               https://addpipe.com/blog/audio-constraints-getusermedia/
               */
  
              var constraints = {
                  audio: true,
                  video: false
              }
  
              /*
               Disable the record button until we get a success or fail from getUserMedia()
               */
  
              recordButton.disabled = true;
              stopButton.disabled = false;
              pauseButton.disabled = false
  
              /*
               We're using the standard promise based getUserMedia()
               https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
               */
  
              navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
                  console.log(&quot;getUserMedia() success, stream created, initializing Recorder.js ...&quot;);
  
                  /*
                   create an audio context after getUserMedia is called
                   sampleRate might change after getUserMedia is called, like it does on macOS when recording through AirPods
                   the sampleRate defaults to the one set in your OS for your playback device
  
                   */
                  audioContext = new AudioContext();
  
                  //update the format
                  document.getElementById(&quot;formats&quot;).innerHTML = &quot;Format: 1 channel pcm @ &quot; + audioContext
                      .sampleRate / 1000 + &quot;kHz&quot;
  
                  /*  assign to gumStream for later use  */
                  gumStream = stream;
  
                  /* use the stream */
                  input = audioContext.createMediaStreamSource(stream);
  
                  /*
                   Create the Recorder object and configure to record mono sound (1 channel)
                   Recording 2 channels  will double the file size
                   */
                  rec = new Recorder(input, {
                      numChannels: 1
                  })
  
                  //start the recording process
                  rec.record()
  
                  console.log(&quot;Recording started&quot;);
  
              }).catch(function(err) {
                  //enable the record button if getUserMedia() fails
                  recordButton.disabled = false;
                  stopButton.disabled = true;
                  pauseButton.disabled = true
              });
          }
  
          function pauseRecording() {
              console.log(&quot;pauseButton clicked rec.recording=&quot;, rec.recording);
              if (rec.recording) {
                  //pause
                  rec.stop();
                  pauseButton.innerHTML = &quot;Resume&quot;;
              } else {
                  //resume
                  rec.record()
                  pauseButton.innerHTML = &quot;Pause&quot;;
  
              }
          }
  
          function stopRecording() {
              console.log(&quot;stopButton clicked&quot;);
  
              //disable the stop button, enable the record too allow for new recordings
              stopButton.disabled = true;
              //false-&gt;true 1 recored
              recordButton.disabled = true;
              pauseButton.disabled = true;
  
              //reset button just in case the recording is stopped while paused
              pauseButton.innerHTML = &quot;Pause&quot;;
  
              //tell the recorder to stop the recording
              rec.stop();
  
              //stop microphone access
              gumStream.getAudioTracks()[0].stop();
  
              //create the wav blob and pass it on to createDownloadLink
              rec.exportWAV(createDownloadLink);
  
          }
  
          function createDownloadLink(blob) {
  
              var url = URL.createObjectURL(blob);
              var au = document.createElement('audio');
              // au.setAttribute('name', 'recorder');
              var li = document.createElement('li');
              var link = document.createElement('a');
              //name of .wav file to use during upload and download (without extendion)
              var filename = new Date().toISOString();
  
              //add controls to the &lt;audio&gt; element
              au.controls = true;
              au.src = url;
              //save to disk link
              link.href = url;
              link.download = filename + &quot;.wav&quot;; //download forces the browser to donwload the file using the  filename
              // link.innerHTML = &quot;Save to disk&quot;;
  
              //add the new audio element to li
              li.appendChild(au);
  
              //add the filename to the li
              li.appendChild(document.createTextNode(filename + &quot;.wav &quot;))
  
              //add the save to disk link to li
              li.appendChild(link);
  
  
              inputElemFile = document.createElement('input')
              inputElemFile.name = &quot;recorder_file&quot;
              inputElemFile.value = blob //string // file
              inputElemFile.type = 'hidden'
              inputElem = document.createElement('input')
              inputElem.name = &quot;recorder&quot;
              inputElem.value = filename + &quot;.wav&quot; //string // file
              inputElem.type = 'hidden'
              var inputDiv = document.getElementById('input-audio');
              inputDiv.append(inputElem);
              //inputDiv.append(inputElemFile);
  
              var xhr = new XMLHttpRequest();
              xhr.onload = function(e) {
                  if (this.readyState === 4) {
                      console.log('save...!')
                  }
              };
  
              var fd = new FormData();
              fd.append(&quot;recorder&quot;, blob, filename + '.wav');
              xhr.open(&quot;POST&quot;, &quot;{{ route('upload.voice.record') }}&quot;, true);
              xhr.send(fd);
  
  
  
  
              //add the li element to the ol
              recordingsList.appendChild(li);
          }
      &lt;/script&gt;
  </code></pre>
  <p>dd($file);</p>
  <pre><code>Illuminate\Http\UploadedFile {#1252
    -test: false
    -originalName: &quot;2022-04-13T11:59:56.133Z.wav&quot;
    -mimeType: &quot;audio/wav&quot;
    -error: 0
    #hashName: null
    path: &quot;C:\xampp\tmp&quot;
    filename: &quot;phpCACD.tmp&quot;
    basename: &quot;phpCACD.tmp&quot;
    pathname: &quot;C:\xampp\tmp\phpCACD.tmp&quot;
    extension: &quot;tmp&quot;
    realPath: &quot;C:\xampp\tmp\phpCACD.tmp&quot;
    aTime: 2022-04-13 11:59:56
    mTime: 2022-04-13 11:59:56
    cTime: 2022-04-13 11:59:56
    inode: 5629499534431248
    size: 41004
    perms: 0100666
    owner: 0
    group: 0
    type: &quot;file&quot;
    writable: true
    readable: true
    executable: false
    file: true
    dir: false
    link: false
    linkTarget: &quot;C:\xampp\tmp\phpCACD.tmp&quot;
  }
  </code></pre>