ctrick Posted June 18, 2015 Share Posted June 18, 2015 Hi there, i am using MAMP Pro for Windows as dev-environment. Installation of PW went fine but I have an issue with image uploading: I have tested if the Dir is writable with this script - there are no problems.. <?php $myfile = fopen("C:\\Windows\\temp\\testfile.txt", "w") or die("Unable to write file!"); $txt = "Test Text\n"; fwrite($myfile, $txt); fclose($myfile); echo "File saved ok."; ?> Any ideas? Thanks! Chris Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 18, 2015 Share Posted June 18, 2015 The error shows single slashes and your example does use double slashes, so firstly it's not the same and secondly the double slashes do not seem right to me even for a windows environment. Link to comment Share on other sites More sharing options...
ctrick Posted June 18, 2015 Author Share Posted June 18, 2015 Modified script works, too. <?php $myfile = fopen('C:\Windows\temp\testfile.txt', "w") or die("Unable to write file!"); $txt = "Test Text\n"; fwrite($myfile, $txt); fclose($myfile); echo "File saved ok."; ?> Link to comment Share on other sites More sharing options...
ctrick Posted June 21, 2015 Author Share Posted June 21, 2015 Mhh.. any ideas? Link to comment Share on other sites More sharing options...
cstevensjr Posted June 21, 2015 Share Posted June 21, 2015 The default MAMP document root (at least for MAMP) is "C:\mamp\htdocs" unless you have changed it in the preferences. That is where your HTML/PHP and image files are stored. The MAMP Pro docs talk about being installed in /Applications/Mamp (how that actually works in Windows is not defined or detailed anywhere I could see). Unfortunately, the MAMP PRO documentation is very Mac specific and it does not talk much about the configuration differences on the Windows version. It's very hard to help you with this when the MAMP PRO docs aren't very helpful. You may also want to ensure that you are using the latest version (3.0.9 Release Candidate 1). You obviously have MAMP Pro working, so the next question would be where is your document root pointed to? 1 Link to comment Share on other sites More sharing options...
ctrick Posted June 21, 2015 Author Share Posted June 21, 2015 I have installed the latest version of MAMP (3.0.9 Release Candidate 1) with default settings. In the hosts-panel I created a .dev host with default PHP version (5.6.8): Is there any way to fix this issue by editing the PW config? In XAMPP for windows PW runs without problems, but i like the way MAMP manages the hosts. Thanks! Link to comment Share on other sites More sharing options...
horst Posted June 21, 2015 Share Posted June 21, 2015 (edited) Hi, the error in your first screen advices you to define $config->uploadTmpDir (in site/config.php) and ensure that it is writeable. So, I don't know MAMP and how it manages things, but I would simply try to find a place for uploads by try and error if there are no useful docs for Windows. For example you can try to create C:\MAMP\htdocs\tmp, and set this in your site/config.php $config->uploadTmpDir = 'c:/mamp/htdocs/tmp/'; // yes, you can use forward slashes, PHP and Apache on Windows converts this internally where needed, also try with trailing slash first! And if this doesn't work, go to that folder with the windows explorer and set it rigths to writeable for everyone as a quick and dirty test. Than try again. If this doesn't help come back here and tell us. (missing trailing slash for the directory ?) You may also try $config->uploadTmpDir = 'c:/windows/tmp/'; // traing slash !! Edited June 21, 2015 by horst 2 Link to comment Share on other sites More sharing options...
ryan Posted June 24, 2015 Share Posted June 24, 2015 This is the sequence of code that gets executed before that error: $dir = wire('config')->uploadTmpDir;if(!$dir || !is_writable($dir)) $dir = ini_get('upload_tmp_dir'); if(!$dir || !is_writable($dir)) $dir = sys_get_temp_dir(); if(!$dir || !is_writable($dir)) throw new WireException("Error writing to $dir. Please define \$config->uploadTmpDir and ensure it is writable."); I don't think the trailing slash matters here, unless that causes Windows to return the wrong permissions for the directory (?). My best guess is that the values returned by both your PHP upload_tmp_dir and sys_get_temp_dir() are not writable or don't exist. Manually specifying the $config->uploadTmpDir would be the best course of action here. 2 Link to comment Share on other sites More sharing options...
netomc Posted September 7, 2015 Share Posted September 7, 2015 (edited) Hi there, i am using MAMP Pro for Windows as dev-environment. Installation of PW went fine but I have an issue with image uploading: I have tested if the Dir is writable with this script - there are no problems.. Any ideas? Thanks! Chris Please try the latest MAMP PRO 3.1.0 from download site: https://www.mamp.info/en/downloads/ Newer version works under System account so access to C:\Windows\temp\ is available. Previous versions used Network Service account and access to C:\Windows\temp\ was forbidden. Edited September 7, 2015 by netomc 1 Link to comment Share on other sites More sharing options...
netomc Posted September 7, 2015 Share Posted September 7, 2015 Have noticed that system uses anti-spam for new users. Hopefully this will not again affect post in this topic. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now