Good day!
Could you check this I got error messages:
Warning: chmod() [function.chmod]: No such file or directory in /eort/www/httcs/nah/eng/testing/upload.php on line 21
Warning: move_uploaded_file(http://www.nwafh.med.sa/Uploads/DSC00197_mail.jpg) [function.move-uploaded-file]: failed to create stream: HTTP wrapper does not support writeable connections. in /eort/www/httcs/nah/eng/testing/upload.php on line 22
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/var/tmp/php.haqFa' to 'http://www.nwafh.med.sa/Uploads/DSC00197_mail.jpg' in /eort/www/httcs/nah/eng/testing/upload.php on line 22
Here is my code:
<?php
print "Hello";
if($submit){
$uploaddir = "http://www.nwafh.med.sa/Uploads/";
$filename = trim($_FILES);
//$filename = substr($filename, -20);
$filename = ereg_replace(" ", "", $filename);
if((ereg(".jpg", $filename)) || (ereg(".gif", $filename))) {
$uploadfile = $uploaddir . $filename;
print("File to upload is: $filename<br>");
print("Upload DIR is: $uploadfile<br>");
chmod($uploadfile, 766); //0644
$ro = move_uploaded_file($_FILES, $uploadfile);
if($ro){
print("File upload was successful");
} else {
print("File upload failed");
}
} else {
print("Only images are allowed (.jpg and .gif), upload failed");
}}
?>
<form enctype="multipart/form-data" method="post" action="upload.php">
Select file:
<input type="file" name="upfile">
<input name="hidden" type="hidden" id="hidden" value="r">
<input type="submit" name="submit" value="Upload">
</form>
Is there any configuration in PHP server to modify?
Regards,
Roland