Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
hi all

in my php page , i want to upload an image, and when i wrote this line , it didn't upload the image however the file name and its destination is correct.

PHP
$target_path = $target_path . basename( $_POST['uploadedfile']);
$desfile="shop_$id.jpg";
if (move_uploaded_file($_POST["file"]["name"],"item/" . $desfile))
{
echo "Uploaded";
}


so, anyone can help me and tell me the reason of this error ,please

thanks
Posted
Updated 10-Jul-12 8:26am
v2
Comments
Sergey Alexandrovich Kryukov 8-Jul-12 14:12pm    
How can we know that all the key names match what you have in the upload form? You show only one-side code and want us to find a bug in it, but...
--SA
[no name] 10-Jul-12 15:13pm    
"tell me the reason of this error"... and that error would be what exactly?

1 solution

I need to see your form.
In case if you did't added then add this attribute and value enctype="multipart/form-data". and make sure your item directory has proper access right for concern user and also make sure your path exists. using is_dir you can get whether your directory exists or not.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900