Cannot create temporary file in unknown PHP upload

Viewed 103

I'm building a desktop app with PHP desktop, I'm using Angular on front and Laravel at back, I'm trying a series of file uploads non of which seem to work on the clients PC but work fine on mine. He gets the error in his console - cannot create temporary file in unknown on line 0. My front-end for upload is

public formdata = new FormData()
setFile(element){
    let file = element.target.files[0];
    let name = element.target.id;
    this.formdata.append(name,file);

  }
   createTraining(data){
  this.formdata.append("data",JSON.stringify(data))
    let url = this.$api.base()+"/training/new";
    this.$http.post(url,this.formdata).subscribe((rez:any)=>{
      console.log(rez);
      if(rez.state){
        this.$modal.dismiss()
      }
    })
  }

My back-end is

  if(@$request->file("tsd_file")){
        $training->tsd_file = @$request->file("tsd_file")->store("public");
      }
      if(@$request->file("sc_file")){
        $training->sc_file = @$request->file("sc_file")->store("public");
      }
      if(@$request->file("ta_file")){
        $training->ta_file = @$request->file("ta_file")->store("public");
      }
      if(@$request->file("tka_file")){
        $training->tka_file = @$request->file("tka_file")->store("public");
      }
      if(@$request->file("dte_file")){
        $training->dte_file = @$request->file("dte_file")->store("public");
      }
      if(@$request->file("ete_file")){
        $training->ete_file = @$request->file("ete_file")->store("public");
      }

Although I hardly believe the above matter. In my local system, PHP's sys_get_temp_dir() function returns "C:\Users\noble\AppData\Local\Temp".

But on the clients pc, his system tmp dir is C://windows/temp. I wonder if that could be a contributing factor, I would appreciate some help in finding ways to resolve this my php.ini in the root of PHP desktop is

; Extensions
extension_dir = "ext/"
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_openssl.dll
extension=php_pdo_mysql.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_sqlite3.dll
extension=php_com_dotnet.dll

; Date
date.timezone=Europe/Berlin
; Errors
error_reporting=E_ALL
display_errors=On
display_startup_errors=On
log_errors=Off
report_memleaks=On
report_zend_debug=On

; General
short_open_tag=On
ignore_user_abort=Off
implicit_flush=Off
output_buffering=0
default_charset = "UTF-8"

; Execution time
max_execution_time=30
extension=php_fileinfo.dll
; Memory
memory_limit=128M

; File uploads
; "post_max_size" must be equal or bigger than "upload_max_filesize"
max_file_uploads=20
upload_max_filesize=20048M
post_max_size=2049M

; Smtp server is not included with phpdesktop
SMTP=127.0.0.1
smtp_port=25

1 Answers

Turns out all I needed to do was have the clients enable write permission and access to the windows temp folder. All works well now

Related