Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
ramfck69 is on a distinguished road
 
Posts: 1
Join Date: Feb 2009
Unhappy Error In Uploading Images (php) - 02-02-2009, 10:04 PM

Hi,

Im ram and trying to build a site which permits visitors to upload images. I have apache installed in my personal computer, which i use first to test if the page works before i upload it. I have made a php script for uploading file. it worked perfectly using apache through localhost. but when i uploaded the page and tried it in my site, im getting an error which says like:


Warning: move_uploaded_file(images/Candle-02-june.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/a5810731/public_html/uploader.php on line 29

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpuBEi6B' to 'images/Candle-02-june.gif' in /home/a5810731/public_html/uploader.php on line 29



in my account here, i have already changed the permission (CHMOD) for that certain page to 777 using the link in the control panel. but still it doesn't work. im still getting the same error.

do you have any idea what causes this and what would be the best way to fix this?

hope to hear from you soon..

thanks bud!




__________________________________________________ _____________________________

here's the PHP section for uploading:


if($_FILES['infile']['type'] == "image/jpg" || $_FILES['infile']['type'] == "image/pjpeg" || $_FILES['infile']['type'] == "image/gif" || $_FILES['infile']['type'] == "image/bmp" || $_FILES['infile']['type'] == "image/jpeg")
{
if($_FILES['infile']['size'] >= 2000 && $_FILES['infile']['size'] <= 2000000)
{
if ($_FILES["infile"]["error"] > 0)
{
echo "Error: " . $_FILES["infile"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["infile"]["name"] . "<br />";
echo "Type: " . $_FILES["infile"]["type"] . "<br />";
echo "Size: " . ($_FILES["infile"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["infile"]["tmp_name"];
if(file_exists("images/".$_FILES['infile']['name']))
{
echo "a file with the same name already exists. <br> if you still want to upload this image, change its filename first to avoid duplicates in the system";
}
else
{
move_uploaded_file($_FILES['infile']['tmp_name'],"images/".$_FILES['infile']['name']);
echo "file successfully uploaded!";
}
}
}
elseif($_FILES['infile']['size'] < 2000)
{
echo "image too small";
}
else
{
echo "image too large";
}
}
else
{
echo "file to be uploaded should be an image file. (jpeg, gif, bmp)";
}




*** infile is the name of my file-type input in the form...

Last edited by ramfck69; 02-02-2009 at 10:11 PM. Reason: PASTED SOME CODES
Reply With Quote
(#2 (permalink))
Old
Junior Member
denny848337 is on a distinguished road
 
Posts: 7
Join Date: Jun 2009
Default 06-24-2009, 06:29 PM

where i can change chmod to 777?
coz i can't found it, thx
Reply With Quote
(#3 (permalink))
Old
Senior Member
FnCool is on a distinguished road
 
Posts: 904
Join Date: Feb 2009
Location: Barrie On CA
Default 06-24-2009, 08:29 PM

in file manager look for a permissions or chmod option, i believe it's in the top right corner.
sorry, i don't use the file manager.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com