NickG21 Posted September 22, 2009 Share Posted September 22, 2009 Hey everyone, I believe I'm aware of what the problem is and why im getting this error. I read in other places online that it's because you can't write to an HTML URL directly and I understand that. My question is how do I reference this upload to a different director containing the /images/ folder that i want them to be stored in. Here is the error followed by my code for the upload and directory structure. Thanks in advance for taking the time to look at this. NickG Error: Warning: move_uploaded_file(http://www.yourlifeoutdoors.com/images/yourlife_logo_v1.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections in /home/alloutd1/public_html/admin/insertproduct.php on line 100 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php0JgELx' to 'http://www.yourlifeoutdoors.com/images/yourlife_logo_v1.jpg' in /home/alloutd1/public_html/admin/insertproduct.php on line 100 Stored in: images/yourlife_logo_v1.jpg Code: <?php if(isset($_POST['submit'])){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 200000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("http://www.yourlifeoutdoors.com/images/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], Line 100: "http://www.yourlifeoutdoors.com/images/" . $_FILES["file"]["name"]); echo "Stored in: " . "images/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; }?> the directory I would like the files stored in is yourlifeoutdoors.com/images/ but the page doing this insertion is located in an admin section of the site... how do i reference to this directory? Quote Link to comment https://forums.phpfreaks.com/topic/175139-solved-image-upload-help-http-wrapper-does-not-support-writeable-connections/ Share on other sites More sharing options...
knsito Posted September 22, 2009 Share Posted September 22, 2009 Based on the errors you are getting <?php move_uploaded_file($_FILES["file"]["tmp_name"], "../images/" . $_FILES["file"]["name"]); ?> Your viewpoint should be server directory structure, not web URL/Is Also I believe this is the same for file_exists() that you are using too Quote Link to comment https://forums.phpfreaks.com/topic/175139-solved-image-upload-help-http-wrapper-does-not-support-writeable-connections/#findComment-923050 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.