4

im facing this problem all day long, i already saw this question(Laravel 5.4 fopen(): Filename cannot be empty) and nothing...

I already edit permission on my C:\Windows\Temp full control to my IISR_IUSERS i'm using NTS PHP version on my IIS 7 on windows server 2008 R2.

on my Laravel code i'm doing this:

$input['picture_url'] = $request->file($fileInForm)->store('uploads');

on my development enviroment it's a Macosx And i was doing this to save the image to my uploads folder that i configure like this:

    /*My code to upload imagem on MACOSX dev enviroment*/

    $input = array();

    $fileInForm = 'picture_url';

    if ($request->hasFile($fileInForm)) {
    $file = $request->file($fileInForm);
    if ($file->isValid()) 
    {
        var_dump($request->file('default_picture_url')->path());
        die();

        // Filename is hashed filename + part of timestamp
        $hashedName = hash_file('md5', $file->pathName());
        //$timestamp = (microtime() * 1000000);

        $newFilename = $hashedName . '.' . $file->getClientOriginalExtension();

       Storage::disk('uploads')->put($newFilename, file_get_contents($file));

       $input['default_picture_url'] = '/uploads/'.$newFilename;
    }
    }

/*My filesystems.php*/
'uploads' => [
            'driver' => 'local',
            'root' => public_path().'/uploads' 
        ],

And I already modified php.ini upload_tmp_dir to C:\Windows\Temp or C:/Windows/Temp

can anyone help me with this please!

1 Answer 1

3

I also faced the same problem in PHP 7.3 and IIS. I will explain below how I resolved this issue.

Step 1: I have given full permission (any user can access) to C:\Windows\Temp.

Step 2: Edit php.ini file upload_tmp_dir = "C:\Windows\Temp", sys_temp_dir = "C:\Windows\Temp"

Step 3: Enable extension extension=fileinfo in php.ini and restart the server.

Initially I used C:\Windows\Temp later I have created separate temp folder and used that folder C:\inetpub\www\temp.

1
  • sorry to take so long to come here and thank you properly for your answer! Jun 27, 2021 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.