Perad Posted November 8, 2007 Share Posted November 8, 2007 I have changed getcwd(); to get_option('port_url') in an attempt to make this a little more dynamic. However I am now getting errors. Could someone help to tell me what is going wrong. Error: Warning: move_uploaded_file(http://localhost/wordpress/portfolio/Photo1.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 93 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpjF23Ia' to 'http://localhost/wordpress/portfolio/Photo1.jpg' in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 93 There was an error uploading the small image, please try again! Warning: move_uploaded_file(http://localhost/wordpress/portfolio/Photo1.jpgPhoto1.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 100 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/phpQyrKVx' to 'http://localhost/wordpress/portfolio/Photo1.jpgPhoto1.jpg' in /Applications/xampp/xamppfiles/htdocs/wordpress/wp-content/plugins/js_portfolio.php on line 100 There was an error uploading the large image, please try again! get_option('port_url') = http://localhost/wordpress/portfolio/ PHP $target_path = get_option('port_url'); if(!file_exists($target_path)) { mkdir($target_path); } /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename($_FILES['port_spic']['name']); if(move_uploaded_file($_FILES['port_spic']['tmp_name'], $target_path)) { $smallimage = $_FILES['port_spic']['name']; } else{ print "There was an error uploading the small image, please try again!"; } $target_path = $target_path . basename($_FILES['port_lpic']['name']); if(move_uploaded_file($_FILES['port_lpic']['tmp_name'], $target_path)) { $largeimage = $_FILES['port_lpic']['name']; } else{ print "There was an error uploading the large image, please try again!"; } Quote Link to comment Share on other sites More sharing options...
Perad Posted November 8, 2007 Author Share Posted November 8, 2007 OK, I found something similar and it says that I cannot use an absolute path for this. What PHP function could I use to find the relative position of the wordpress folder? Quote Link to comment Share on other sites More sharing options...
drranch Posted November 8, 2007 Share Posted November 8, 2007 http://www.dmcinsights.com/phorum/read.php?5,3275 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.