|
-
May 14th, 2005, 09:40 AM
#1
Thread Starter
PowerPoster
File Upload
Ok i'm missing somthing here, i've done file uplaod a million times but i cant get this one working.....
my upload script is below.
PHP Code:
<?php
$uploaddir = "http://lindowltc.org.uk/news/";
if(is_uploaded_file($_FILES['file']['tmp_name']))
{
move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']);
}
$path = "http://'site'.org.uk/news/" . $_FILES['file']['name'];
$msg = "Image Uploaded";
$host="localhost";
$user="a";
$password="b";
$database="c";
$connection = mysql_connect($host,$user,$password);
$db = mysql_select_db($database,$connection);
$query =("REPLACE INTO tblNews(id,news) VALUES (1,'$path')");
header('Location: http://'site'/Admin/news/upload.php?path='.$path."&msg=".$msg);
?>
I'm trying to store the path the file is uploaded to (So and replace the existing path in the DB)
PHP Code:
<form enctype="multipart/form-data" action="doUpload.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<strong>Upload An Image</strong> -<input type="file" name="file" size="60">
<input type="submit" name="upload" value ="Upload News">
</form>
That the actual upload form,
Am i missing somthing simple here?
the errors are,
Warning: move_uploaded_file(http://path/news//50.jpg[/url]): failed to open stream: HTTP wrapper does not support writeable connections. in /home/lindowltcuk/public_html/Admin/letter/doUpload.php on line 6
Warning: move_uploaded_file(): Unable to move '/tmp/phpnRLz5L' to 'http://path/news//50.jpg' in /home/path/public_html/Admin/letter/doUpload.php on line 6
http://path/news/50.jpg
Warning: Cannot modify header information - headers already sent by (output started at /home/path/public_html/Admin/letter/doUpload.php:6) in /home/path/public_html/Admin/letter/doUpload.php on line 23
Last edited by Pino; May 14th, 2005 at 09:50 AM.
-
May 14th, 2005, 05:34 PM
#2
Re: File Upload
You can only copy, move or write to a file on the local file system. The move location is a url and is not writable.
-
May 14th, 2005, 11:37 PM
#3
New Member
Re: File Upload
I got that error today, I cant remember if its exactly the same, but how I went about fixing it was, I use smartFTP (www.smartftp.com), so I went to the folder it was sending the data to pressed f7 on it and changed its permission from 755 to 777.
-
May 15th, 2005, 03:42 AM
#4
Thread Starter
PowerPoster
Re: File Upload
Thanks, i've allready set the permissions though i think it what visual ad said. I'll try it as soon as i get some time
-
May 16th, 2005, 12:00 PM
#5
Thread Starter
PowerPoster
Re: File Upload
Ok hit a small problem,
the directory the uplaod is in is,
home/admin/letter/upload.php
this directory is .htaccess protected. now then how do i upload to a directory which is 'further back'
ie - home/letter/
what would is et the $uploaddir = ""; to?
-
May 16th, 2005, 12:07 PM
#6
Re: File Upload
You should use an absolute file path which beings with a solidus (/) "/home/letter/upload"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|