Rohitashv Singhal Rohitashv Singhal - 3 months ago 15
PHP Question

Getting error with move_uploaded_file HTTP wrapper does not support writeable connections

I am currently working on a project with php. Here I want to store the image into folder using

move_uploaded_file
but when I use the following code :

if (move_uploaded_file($_FILES['file_promo_image']['tmp_name'], $uploadfile))
{
echo "Le fichier est valide, et a été téléchargé avec succès.\n";

}


I am getting the following error :

Warning: move_uploaded_file(http://www.desgensbien.com/sites/bestinfo/images/news/CodeCogsEqn.gif) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /homez.534/desgensb/www/sites/bestinfo/admin/record-news.php on line 73



Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpfCHv2s' to 'http://www.desgensbien.com/sites/bestinfo/images/news/CodeCogsEqn.gif' in /homez.534/desgensb/www/sites/bestinfo/admin/record-news.php on line 73


How can I resolve this issue

Answer

Use this:

$uploadfile = $_SERVER['DOCUMENT_ROOT'] . '/sites/bestinfo/images/news/CodeCogsEqn.gif';