سؤال

I was trying to upload a custom logo to my drupal site which runs on IIS 8 with PHP.
I got the following upload error :


" Warning: move_uploaded_file(temporary://logo.png): failed to open stream: "DrupalTemporaryStreamWrapper::stream_open" call failed in drupal_move_uploaded_file() (line 1642 of C:\inetpub\wwwroot\drupalfull\includes\file.inc). Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php25C3.tmp' to 'temporary://logo.png' in drupal_move_uploaded_file() (line 1642 of C:\inetpub\wwwroot\drupalfull\includes\file.inc). File upload error. Could not move uploaded file." Please help me. I have set both read and write permissions on IIS but still it does not work.

هل كانت مفيدة؟

المحلول 2

If you are running ISS8 (web server) then the file path is different then the default for Unix. Make sure you have the temporary folder setup correctly on your settings in Drupal and the folder has write permissions.

You can follow this article at step 5 and 6. Create the folder:

Drupal uses the Sites\Default\Files directory to store temporary files and therefore must be able to write and modify files in this folder.

  1. Create the folder:

C:\inetpub\wwwroot\Drupal>md sites\default\files

http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/install-drupal-on-iis

نصائح أخرى

Create sites/default/files/tmp folder and give full permissions (777) and change 'Temporary directory' at admin/config/media/file-system.

I think it fixes yout problem.

Regards.

Your problem is most likely the permission problem inside drupal. Since you are using windows system, you need to make sure the folder sites/default/files have writable permission for the IIS server. Config the permission to be writable for all user and see if it is working and then limit the permission step by step until you feel comfortable.

I'm going to put another answer in here because I guarantee I'm going to forget how I fixed it!

Basically, on Windows, the default upload folder for PHP is C:\Windows\Temp. As part of the Drupal upload, it moves files from the PHP upload folder to the Drupal Temporary//: folder. There is an issue however in PHP whereby the PHP executable needs read permission to the full path to the uploaded files, so C:\Windows\Temp. If this is not given, it will error out and the file will not be moved.

Details are at http://php.net/manual/en/function.realpath.php which is a function call made deep in Drupal's upload file code.

My fix was to create a folder elsewhere, say C:\PHPTemp, and modify PHP's settings (session.save_path and upload_tmp_dir) to point to this folder instead. After giving IIS_IUSRS full control (overkill? probably!), I was then able to upload images!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top