php help

Soldato
Joined
3 Jun 2008
Posts
5,060
I am trying to get an image uploading script to work. I get the following error when I try to use it to upload a file.



PHP Error Message

Warning: move_uploaded_file(/home/a2359472/public_html/pics/userpics) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/a2359472/public_html/test/index.php on line 46


PHP Error Message

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpxkAqBx' to '/home/a2359472/public_html/pics/userpics' in /home/a2359472/public_html/test/index.php on line 46

Any help is greatly appreciated.
 
Im a complete noob at this so I dont really know what you mean by "Try using if file exists to check."

Could you please clarify?

Cheers.
 
<?php
if ($_REQUEST[completed] == 1) {
$newname = uniqid("whc").".jpg";
move_uploaded_file($_FILES['mailfile']['tmp_name'],
"/home/a2359472/public_html/pics/userpics");
} ?>
<html>
<head><title>Upload page</title></head>
<body><h1>Image Uploader</h1>
<?php if ($_REQUEST[completed] != 1) { ?>
<b>Please upload an image</b><br>
<form enctype=multipart/form-data method=post>
<input type=hidden name=MAX_FILE_SIZE value=1500000>
<input type=hidden name=completed value=1>
Choose file to send: <input type=file name=mailfile> and
<input type=submit></form>
<?php } else { ?>
<b>Thanks, your picture will be on the site shortly</b>
<?php } ?>
<hr>
Copyright, etc
</body></html>

Cheers guys
 
Got a little further with that, before the error was on the same page but now i get this error on a separate page

PHP Error Message

Parse error: syntax error, unexpected '"' in /home/a2359472/public_html/test/index.php on line 46
 
Back
Top Bottom