Jump to content
Sign in to follow this  
Mencarta

Uploading Files

Recommended Posts

I get the error: Warning: move_uploaded_file(http://localhost/projects/pptxfever.pptx) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections in C:\apache\server\projects\upload.php on line 8Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\TEMP\php1B8.tmp' to 'http://localhost/projects/pptxfever.pptx' in C:\apache\server\projects\upload.php on line 8When I try to run upload files with this script:upload.php

<?php	if (isset($_POST["type"])) {		if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {			$tmp = $_FILES["file"]["tmp_name"];			$name = $_FILES["file"]["name"];			$dir = "http://localhost/projects/".$_POST["type"].$name;			move_uploaded_file($tmp,$dir);		}	}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>	<head>		<title>Fever 1793 - Upload</title>		<link rel="stylesheet" type="text/css" href="fever.css" />		<script type="text/javascript" src="jquery.js"></script>		<script type="text/javascript">			$(function() {				$("div.file").slideUp("fast");				$("div.link").slideUp("fast");				$("input.file").click(function() {					$("div.link").slideUp("slow");					$("div.file").slideDown("slow");				});				$("input.link").click(function() {					$("div.file").slideUp("slow");					$("div.link").slideDown("slow");				});			})		</script>	</head>	<body>		<div id="header">			<h1>Fever 1793</h1>		</div>		<div id="page">			<form enctype="multipart/form-data" action="upload.php" method="post">			Upload: <input class="link" type="radio" name="type" value="link"> <b>Link</b> | <input class="file" type="radio" name="type" value="pptx"> <b>Powerpoint</b> | <input class="file" type="radio" name="type" value="scrapbooks"> <b>Scrapbook</b> | <input class="link" type="radio" name="type" value="gallery"> <b>Gallery</b>			<br />			<br />			<div class="file">				File: <input type="file" name="file">				<br />				<input type="submit" value="Upload" />			</div>			<div class="link">				Link: <input name="link" type="text" maxlength="200" />				<br />				<input type="submit" value="Upload" />			</div>			</form>		</div>	</body></html>

Does anybody know why?

Share this post


Link to post
Share on other sites

You can't specify the destination using HTTP, the HTTP protocol does not allow you to write files. Use a local file path instead.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...